use of net.minecraft.network.IPacket in project Bookshelf by Darkhax-Minecraft.
the class TileEntityBasic method sync.
/**
* Synchronizes the server state of the tile with all clients tracking it.
*
* @param renderUpdate Whether or not a render update should happen as well. Only use this
* if you need to change the block model.
*/
public void sync(boolean renderUpdate) {
if (renderUpdate) {
this.setChanged();
final BlockState state = this.getState();
this.level.sendBlockUpdated(this.worldPosition, state, state, BlockFlags.DEFAULT_AND_RERENDER);
} else if (this.level instanceof ServerWorld) {
final IPacket<?> packet = this.getUpdatePacket();
WorldUtils.sendToTracking((ServerWorld) this.level, this.getChunkPos(), packet, false);
}
}
Aggregations