Пример #1
0
 public void readFromNBT(NBTTagCompound nbttagcompound) {
   super.readFromNBT(nbttagcompound);
   woodType = nbttagcompound.getByte("woodType");
   NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
   storage = 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 < storage.length) {
       storage[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
     }
   }
 }
Пример #2
0
 public void writeToNBT(NBTTagCompound nbttagcompound) {
   super.writeToNBT(nbttagcompound);
   NBTTagList nbttaglist = new NBTTagList();
   for (int i = 0; i < storage.length; i++) {
     if (storage[i] != null) {
       NBTTagCompound nbttagcompound1 = new NBTTagCompound();
       nbttagcompound1.setByte("Slot", (byte) i);
       storage[i].writeToNBT(nbttagcompound1);
       nbttaglist.appendTag(nbttagcompound1);
     }
   }
   nbttagcompound.setTag("Items", nbttaglist);
   nbttagcompound.setByte("woodType", woodType);
 }