public void readFromNBT(NBTTagCompound tagCompound) {
    if (tagCompound != null) {
      NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
      for (int i = 0; i < tagList.tagCount(); ++i) {
        NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);

        if (itemstack != null) {
          this.inventory[j] = itemstack;
        }
      }
    }
  }
  /* Save/Load */
  public void saveToNBT(NBTTagCompound tagCompound) {
    NBTTagList tagList = new NBTTagList();
    NBTTagCompound invSlot;

    for (int i = 0; i < this.inventory.length; ++i) {
      if (this.inventory[i] != null) {
        invSlot = new NBTTagCompound();
        invSlot.setByte("Slot", (byte) i);
        this.inventory[i].writeToNBT(invSlot);
        tagList.appendTag(invSlot);
      }
    }

    tagCompound.setTag("Inventory", tagList);
  }