Advertisement
Guest User

Untitled

a guest
Mar 26th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. public void writeToNBT(NBTTagCompound compound)
  2. {
  3. super.writeToNBT(compound);
  4. if (itemStack != null){
  5. compound.setTag("heldItem", itemStack.writeToNBT(new NBTTagCompound()));
  6. }
  7. }
  8. public void readFromNBT(NBTTagCompound compound)
  9. {
  10. super.readFromNBT(compound);
  11. if (compound.getCompoundTag("heldItem") != null){
  12. itemStack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("heldItem"));
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement