@Override
  public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    tank.readFromNBT(tag.getCompoundTag("tank"));
    stack = new ItemStack[this.getSizeInventory()];
    NBTTagList list = tag.getTagList("inventory", 10);
    for (int i = 0; i < list.tagCount(); ++i) {
      NBTTagCompound nbttagcompound = list.getCompoundTagAt(i);
      int j = nbttagcompound.getByte("Slot") & 255;

      if (j >= 0 && j < this.stack.length) {
        this.stack[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
      }
    }
    this.progress = tag.getInteger("progress");
  }
 @Override
 public NBTTagCompound writeToNBT(NBTTagCompound tag) {
   super.writeToNBT(tag);
   tag.setTag("tank", tank.writeToNBT(new NBTTagCompound()));
   NBTTagList list = new NBTTagList();
   for (int i = 0; i < stack.length; i++) {
     if (stack[i] != null) {
       NBTTagCompound t = new NBTTagCompound();
       stack[i].writeToNBT(t);
       t.setByte("Slot", (byte) i);
       list.appendTag(t);
     }
   }
   tag.setTag("inventory", list);
   tag.setInteger("progress", progress);
   return tag;
 }