Search in sources :

Example 6 with BlockPart

use of org.terasology.world.block.BlockPart in project Terasology by MovingBlocks.

the class AutoBlockProvider method getAssetData.

@Override
public Optional<BlockFamilyDefinitionData> getAssetData(ResourceUrn urn) throws IOException {
    Optional<BlockTile> blockTile = assetManager.getAsset(urn, BlockTile.class);
    if (blockTile.isPresent() && blockTile.get().isAutoBlock()) {
        BlockFamilyDefinitionData data = new BlockFamilyDefinitionData();
        for (BlockPart part : BlockPart.values()) {
            data.getBaseSection().getBlockTiles().put(part, blockTile.get());
        }
        data.getBaseSection().setSounds(assetManager.getAsset("engine:default", BlockSounds.class).get());
        data.setFamilyFactory(freeformBlockFamilyFactory);
        return Optional.of(data);
    }
    return Optional.empty();
}
Also used : BlockPart(org.terasology.world.block.BlockPart) BlockTile(org.terasology.world.block.tiles.BlockTile)

Example 7 with BlockPart

use of org.terasology.world.block.BlockPart in project Terasology by MovingBlocks.

the class BlockShapeImpl method doReload.

@Override
protected void doReload(BlockShapeData data) {
    collisionShape.clear();
    displayName = data.getDisplayName();
    for (BlockPart part : BlockPart.values()) {
        this.meshParts.put(part, data.getMeshPart(part));
    }
    for (Side side : Side.values()) {
        this.fullSide.put(side, data.isBlockingSide(side));
    }
    this.baseCollisionShape = data.getCollisionShape();
    this.baseCollisionOffset.set(data.getCollisionOffset());
    collisionShape.put(Rotation.none(), baseCollisionShape);
    yawSymmetric = data.isYawSymmetric();
    pitchSymmetric = data.isPitchSymmetric();
    rollSymmetric = data.isRollSymmetric();
}
Also used : BlockPart(org.terasology.world.block.BlockPart) Side(org.terasology.math.Side)

Aggregations

BlockPart (org.terasology.world.block.BlockPart)7 Side (org.terasology.math.Side)3 BlockMeshPart (org.terasology.world.block.shapes.BlockMeshPart)3 BlockTile (org.terasology.world.block.tiles.BlockTile)2 ResourceUrn (org.terasology.assets.ResourceUrn)1 Vector2f (org.terasology.math.geom.Vector2f)1 Block (org.terasology.world.block.Block)1 BlockAppearance (org.terasology.world.block.BlockAppearance)1