Ejemplo n.º 1
0
  public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);
    // timeleft = nbttagcompound.getInteger("timeleft");

    NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
    metalItemStacks = new ItemStack[getSizeInventory()];
    for (int i = 0; i < nbttaglist.tagCount(); i++) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
      byte byte0 = nbttagcompound1.getByte("Slot");
      if (byte0 >= 0 && byte0 < metalItemStacks.length) {
        metalItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
    }
  }
Ejemplo n.º 2
0
  public void writeToNBT(NBTTagCompound nbttagcompound) {
    super.writeToNBT(nbttagcompound);
    // nbttagcompound.setInteger("timeleft", timeleft);

    NBTTagList nbttaglist = new NBTTagList();
    for (int i = 0; i < metalItemStacks.length; i++) {
      if (metalItemStacks[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        metalItemStacks[i].writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }

    nbttagcompound.setTag("Items", nbttaglist);
  }