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();
}
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();
}
Aggregations