Returns the packet to send to nearby players when the block entity's observable
state changes, or
null
to not send the packet.
If the data returned by initial chunk data
is suitable
for updates, the following shortcut can be used to create an update packet:
BlockEntityUpdateS2CPacket.create(this)
. The NBT will be passed to BlockEntity.readNbt(net.minecraft.nbt.NbtCompound, net.minecraft.registry.RegistryWrapper.WrapperLookup)
on the client.
"Observable state" is a state that clients can observe without specific interaction.
For example, CampfireBlockEntity
's cooked items are observable states,
but chests' inventories are not observable states, since the player must first open
that chest before they can see the contents.
To sync block entity data using this method, use
serverWorld.getChunkManager().markForUpdate(this.getPos());
.