@Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); NBTTagCompound tag1 = new NBTTagCompound(); inventory.writeToNBT(tag1); tag.setTag("inventory", tag1); }