Where the needed imports (for Minecraft 1.7.10) are:
Now, that we can send the packet (theoretically, it isn’t doing anything, yet) we need to set up the logic to receive the packet, also known as
NOTE: func_148857_g may be called getNbtCompound in newer versions.
Now that we have the basic logic, there is one final thing we need to know before all this code will do anything effectively in our code base.
We need to add a notification to the Minecraft Server that the tile has changed and needs an update and to do this, we invoke the
world.markBlockForUpdate(x, y, z) function with the co-ordinates of the Tile Entity in the world.
I tend to add a small helper function to my base tile entities that calls the mark for update function properly by using
This allows for quick and simple updating without having to remember to call the right params for a little more JVM overhead (terms of microseconds).
You may have realized that this is described as a quick and dirty hack for syncing your Minecraft tile entities, there are multiple places such as heavy updating and large amounts of information where it would be much more efficient to use a different, more advanced approach other than