/** * Standard method to write the inventory data of this TE to the NBTCompound that stores this TE's * Data. * * @return A NBTTagList with all stacks in the inventory. */ protected NBTBase writeInventoryToCompound() { IItemStorage inventory = (IItemStorage) this; NBTTagList inventoryList = new NBTTagList(); for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack stack = inventory.getStackInSlot(i); if (stack == null) continue; NBTTagCompound slotCompound = new NBTTagCompound(); slotCompound.setInteger(CoreReferences.NBT.InventoryData.SLOTINDEX, i); slotCompound.setTag( CoreReferences.NBT.InventoryData.STACKDATA, stack.writeToNBT(new NBTTagCompound())); inventoryList.appendTag(slotCompound); } return inventoryList; }