Search in sources :

Example 6 with BlockTile

use of org.terasology.engine.world.block.tiles.BlockTile in project Terasology by MovingBlocks.

the class BlockBuilder method applyLiquidShapes.

private void applyLiquidShapes(Block block, Map<BlockPart, BlockTile> tiles) {
    for (Side side : Side.values()) {
        BlockPart part = BlockPart.fromSide(side);
        BlockTile blockTile = tiles.get(part);
        if (blockTile != null) {
            BlockMeshPart lowMeshPart = lowShape.getMeshPart(part).mapTexCoords(worldAtlas.getTexCoords(blockTile, true), worldAtlas.getRelativeTileSize(), blockTile.getLength());
            block.setLowLiquidMesh(part.getSide(), lowMeshPart);
            BlockMeshPart topMeshPart = topShape.getMeshPart(part).mapTexCoords(worldAtlas.getTexCoords(blockTile, true), worldAtlas.getRelativeTileSize(), blockTile.getLength());
            block.setTopLiquidMesh(part.getSide(), topMeshPart);
        }
    }
}
Also used : Side(org.terasology.engine.math.Side) BlockPart(org.terasology.engine.world.block.BlockPart) BlockTile(org.terasology.engine.world.block.tiles.BlockTile) BlockMeshPart(org.terasology.engine.world.block.shapes.BlockMeshPart)

Aggregations

BlockTile (org.terasology.engine.world.block.tiles.BlockTile)6 PojoPrefab (org.terasology.engine.entitySystem.prefab.internal.PojoPrefab)3 BehaviorTree (org.terasology.engine.logic.behavior.asset.BehaviorTree)3 BlockPart (org.terasology.engine.world.block.BlockPart)3 ModuleManager (org.terasology.engine.core.module.ModuleManager)2 BlockFamilyDefinition (org.terasology.engine.world.block.loader.BlockFamilyDefinition)2 BlockFamilyDefinitionData (org.terasology.engine.world.block.loader.BlockFamilyDefinitionData)2 BlockFamilyDefinitionFormat (org.terasology.engine.world.block.loader.BlockFamilyDefinitionFormat)2 BlockMeshPart (org.terasology.engine.world.block.shapes.BlockMeshPart)2 BlockShapeImpl (org.terasology.engine.world.block.shapes.BlockShapeImpl)2 BlockSounds (org.terasology.engine.world.block.sounds.BlockSounds)2 UIElement (org.terasology.nui.asset.UIElement)2 UISkinAsset (org.terasology.nui.skin.UISkinAsset)2 IOException (java.io.IOException)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Quaternionf (org.joml.Quaternionf)1 Vector2f (org.joml.Vector2f)1