Exemplo n.º 1
0
  @Override
  public void readFromNBT(NBTTagCompound nbt) {
    super.readFromNBT(nbt);
    NBTTagList var2 = nbt.getTagList("Items");
    this.containingItems = new ItemStack[this.getSizeInventory()];

    for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
      NBTTagCompound var4 = (NBTTagCompound) var2.tagAt(var3);
      byte var5 = var4.getByte("Slot");

      if (var5 >= 0 && var5 < this.containingItems.length) {
        this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4);
      }
    }
    this.fangXiang = nbt.getByte("fangXiang");
  }
Exemplo n.º 2
0
  @Override
  public void writeToNBT(NBTTagCompound nbt) {
    super.writeToNBT(nbt);
    NBTTagList var2 = new NBTTagList();

    for (int var3 = 0; var3 < this.containingItems.length; ++var3) {
      if (this.containingItems[var3] != null) {
        NBTTagCompound var4 = new NBTTagCompound();
        var4.setByte("Slot", (byte) var3);
        this.containingItems[var3].writeToNBT(var4);
        var2.appendTag(var4);
      }
    }

    nbt.setTag("Items", var2);
    nbt.setByte("fangXiang", this.fangXiang);
  }