Beispiel #1
0
 private void applyLoweredShape(Block block, BlockShape shape, Map<BlockPart, AssetUri> tileUris) {
   for (Side side : Side.values()) {
     BlockPart part = BlockPart.fromSide(side);
     BlockMeshPart meshPart =
         shape
             .getMeshPart(part)
             .rotate(Rotation.none().getQuat4f())
             .mapTexCoords(
                 atlas.getTexCoords(tileUris.get(part), true), atlas.getRelativeTileSize());
     block.setLoweredLiquidMesh(part.getSide(), meshPart);
   }
 }
Beispiel #2
0
 private BlockAppearance createAppearance(
     BlockShape shape, Map<BlockPart, AssetUri> tileUris, Rotation rot) {
   Map<BlockPart, BlockMeshPart> meshParts = Maps.newEnumMap(BlockPart.class);
   Map<BlockPart, Vector2f> textureAtlasPositions = Maps.newEnumMap(BlockPart.class);
   for (BlockPart part : BlockPart.values()) {
     // TODO: Need to be more sensible with the texture atlas. Because things like block particles
     // read from a part that may not exist, we're being fairly lenient
     Vector2f atlasPos = atlas.getTexCoords(tileUris.get(part), shape.getMeshPart(part) != null);
     BlockPart targetPart = part.rotate(rot);
     textureAtlasPositions.put(targetPart, atlasPos);
     if (shape.getMeshPart(part) != null) {
       meshParts.put(
           targetPart,
           shape
               .getMeshPart(part)
               .rotate(rot.getQuat4f())
               .mapTexCoords(atlasPos, atlas.getRelativeTileSize()));
     }
   }
   return new BlockAppearance(meshParts, textureAtlasPositions);
 }