1.9.4 TE Syncing
Only accurate for 1922+
When the chunk/block data is sent (client receiving chunks from server):
- getUpdateTag() called serverside to get compound to sync
- handleUpdateTag() called to handle it clientside
- what vanilla does
- Writes ALL data into this tag by calling writeToNBT
- Reads it all back out using readFromNBT
- Mods:
- Put whatever you want to be initially synced with the chunk, it comes back to you in handleUpdateTag()
- Caveat: whatever tag you return must have the position of the TE in the "x" "y" and "z" tags. Otherwise MC doesn't know which TE to apply the packet to since we don't have anything like entity ID's. Any packets whose tags are missing "x" "y" and "z" are silently discarded. The default implementation of getUpdateTag already does this for you so just call super and add on to it.
When individual TE's are (re)synced (via notifyBlockUpdate, placing blocks, etc):
- getUpdatePacket() called serverside to get a SPacketUpdateTileEntity
- onDataPacket() called to handle it clientside for mods
- what vanilla does: uses the compound from getUpdateTag()
- Writes ALL data into this tag by calling writeToNBT
- Reads it all back out using readFromNBT
- Mods:
- Put whatever you want to be sent in subsequent resyncs, it comes back to you in onDataPacket()
- Noncaveat: The position of the TE is in the packet, so this compound need not have the TE position
To resync a TE by hand:
- Call notifyBlockUpdate with the "send to client" flag set
- use getUpdatePacket() to get the packet and send it yourself.