@Override public void writeToNBT(NBTTagCompound NBT) { super.writeToNBT(NBT); for (int i = 0; i < Enchantment.enchantmentsList.length; i++) { if (Enchantment.enchantmentsList[i] != null) { int lvl = this.getEnchantment(Enchantment.enchantmentsList[i]); if (lvl > 0) NBT.setInteger(Enchantment.enchantmentsList[i].getName(), lvl); } } }
@Override public void writeToNBT(NBTTagCompound NBT) { super.writeToNBT(NBT); for (int i = 0; i < Enchantment.enchantmentsList.length; i++) { if (Enchantment.enchantmentsList[i] != null) { int lvl = this.getEnchantment(Enchantment.enchantmentsList[i]); if (lvl > 0) NBT.setInteger(Enchantment.enchantmentsList[i].getName(), lvl); } } NBTTagList li = new NBTTagList(); NBT.setTag("extra", li); for (ItemStack is : overflow) { NBTTagCompound tag = new NBTTagCompound(); is.writeToNBT(tag); li.appendTag(tag); } }