use of org.terasology.engine.world.block.BlockPart in project Terasology by MovingBlocks.
the class BlockBuilder method constructCustomBlock.
@Override
public Block constructCustomBlock(String defaultName, BlockShape shape, Rotation rotation, SectionDefinitionData section, BlockUri uri, BlockFamily blockFamily) {
Block block = createRawBlock(defaultName, section);
block.setRotation(rotation);
block.setPrimaryAppearance(createAppearance(shape, section.getBlockTiles(), rotation));
setBlockFullSides(block, shape, rotation);
block.setCollision(shape.getCollisionOffset(rotation), shape.getCollisionShape(rotation));
for (BlockPart part : BlockPart.values()) {
block.setColorSource(part, section.getColorSources().get(part));
block.setColorOffset(part, new Color().set(section.getColorOffsets().get(part)));
}
block.setUri(uri);
block.setBlockFamily(blockFamily);
// Lowered mesh for liquids
if (block.isLiquid()) {
applyLiquidShapes(block, section.getBlockTiles());
}
return block;
}
use of org.terasology.engine.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[side.ordinal()] = 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();
}
Aggregations