Skip to content

Instantly share code, notes, and snippets.

@mDiyo
Last active December 13, 2015 23:39
Show Gist options
  • Save mDiyo/4993441 to your computer and use it in GitHub Desktop.
Save mDiyo/4993441 to your computer and use it in GitHub Desktop.
Description Packet
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
readCustomNBT(tags);
}
public void readNetworkNBT(NBTTagCompound tags)
{
//Anything that needs synced in here
}
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
writeCustomNBT(tags);
}
public void writeNetworkNBT (NBTTagCompound tags)
{
//Anything worth sending in here
}
@Override
public Packet getDescriptionPacket ()
{
NBTTagCompound tag = new NBTTagCompound();
writeNetworkNBT(tag);
return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
{
readNetworkNBT(packet.data);
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
@Speiger
Copy link

Speiger commented Sep 15, 2013

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment