Skip to content

Instantly share code, notes, and snippets.

@ft975
Last active December 19, 2015 00:59
Show Gist options
  • Save ft975/5872997 to your computer and use it in GitHub Desktop.
Save ft975/5872997 to your computer and use it in GitHub Desktop.
@override public Packet getDescriptionPacket() {
final NBTTagCompound tc = new NBTTagCompound(); // Make a new TagCompound to store the data in
super.writeToNBT(tc); // Tell the superclass TE to fill the tag compound with data
this.writeToNBT(tc); // Tell the current TE to fill the tag compound with data
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 2, tc); // Make a new packet with the information Par1 = xPosition, par2 = yPosition, par3 = zPosition, par4 = ???, par5 = tag compound we just filled with information
}
@override public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) {
super.onDataPacket(net, pkt); // Do things like postion and anything else minecraft wants to do
readFromNBT(pkt.customParam1); // Read the packet ourselves and get inforation stored in the tag compound
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment