use of org.terasology.world.block.family.UpdatesWithNeighboursFamily in project Terasology by MovingBlocks.
the class NeighbourBlockFamilyUpdateSystem method processUpdateForBlockLocation.
private void processUpdateForBlockLocation(Vector3i blockLocation) {
for (Side side : Side.values()) {
Vector3i neighborLocation = new Vector3i(blockLocation);
neighborLocation.add(side.getVector3i());
if (worldProvider.isBlockRelevant(neighborLocation)) {
Block neighborBlock = worldProvider.getBlock(neighborLocation);
final BlockFamily blockFamily = neighborBlock.getBlockFamily();
if (blockFamily instanceof UpdatesWithNeighboursFamily) {
UpdatesWithNeighboursFamily neighboursFamily = (UpdatesWithNeighboursFamily) blockFamily;
Block neighborBlockAfterUpdate = neighboursFamily.getBlockForNeighborUpdate(worldProvider, blockEntityRegistry, neighborLocation, neighborBlock);
if (neighborBlock != neighborBlockAfterUpdate) {
worldProvider.setBlock(neighborLocation, neighborBlockAfterUpdate);
}
}
}
}
}
Aggregations