/** (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setByte("Dir", (byte) direction); par1NBTTagCompound.setString("Motive", art.title); par1NBTTagCompound.setInteger("TileX", xPosition); par1NBTTagCompound.setInteger("TileY", yPosition); par1NBTTagCompound.setInteger("TileZ", zPosition); }
/* Save/Load */ public void saveToNBT(NBTTagCompound tagCompound) { NBTTagList tagList = new NBTTagList(); NBTTagCompound invSlot; for (int i = 0; i < this.inventory.length; ++i) { if (this.inventory[i] != null) { invSlot = new NBTTagCompound(); invSlot.setByte("Slot", (byte) i); this.inventory[i].writeToNBT(invSlot); tagList.appendTag(invSlot); } } tagCompound.setTag("Inventory", tagList); }