use of org.terasology.world.OnChangedBlock in project Terasology by MovingBlocks.
the class EntityAwareWorldProvider method updateBlockEntity.
private void updateBlockEntity(EntityRef blockEntity, Vector3i pos, Block oldType, Block type, boolean forceEntityUpdate, Set<Class<? extends Component>> retainComponents) {
if (type.isKeepActive()) {
temporaryBlockEntities.remove(blockEntity);
} else if (oldType.isKeepActive() && isTemporaryBlock(blockEntity, type)) {
temporaryBlockEntities.add(blockEntity);
}
if (forceEntityUpdate || !(Objects.equal(oldType.getBlockFamily(), type.getBlockFamily()) && Objects.equal(oldType.getPrefab(), type.getPrefab()))) {
updateBlockEntityComponents(blockEntity, oldType, type, retainComponents);
}
EntityRef regionEntity = blockRegionLookup.get(pos);
if (regionEntity != null) {
regionEntity.send(new OnChangedBlock(pos, type, oldType));
}
blockEntity.send(new OnChangedBlock(new Vector3i(pos), type, oldType));
}
Aggregations