Exemplo n.º 1
0
  @Override
  public void writeToNBT(NBTTagCompound nbtTagCompound) {
    super.writeToNBT(nbtTagCompound);

    NBTTagList list = new NBTTagList();
    for (int currentIndex = 0; currentIndex < inv.length; ++currentIndex) {
      if (inv[currentIndex] != null) {
        NBTTagCompound nbt = new NBTTagCompound();
        nbt.setByte("Slot", (byte) currentIndex);
        inv[currentIndex].writeToNBT(nbt);
        list.appendTag(nbt);
      }
    }
    nbtTagCompound.setTag("Inventory", list);
  }