- 1
- 0
Проблема с nbt при попытки сохрнаить расширенные свойства моего объекта в nbt:
Код:
public static void saveInventoryToExtendedPro(EntityPlayer player, Inventory inv){
InventoryProperties pro= InventoryProperties.get(player);
NBTTagCompound tag = new NBTTagCompound();
for(int i = 0;i<size;i++){
ItemStack stack = inv.getStackInSlot(i);
if(stack != null)ChatUtils.sendMsg(player,""+i+" "+(stack == null ? "null":stack.getDisplayName()));
if(stack != null)tag.setTag(i+"",stack.writeToNBT(tag));
}
pro.inventory = tag;
}
tag - это экземпляр nbt, который сохраняется.
Код:
public static void saveInventoryToExtendedPro(EntityPlayer player, Inventory inv){
InventoryProperties pro= InventoryProperties.get(player);
NBTTagCompound tag = new NBTTagCompound();
for(int i = 0;i<size;i++){
ItemStack stack = inv.getStackInSlot(i);
if(stack != null)ChatUtils.sendMsg(player,""+i+" "+(stack == null ? "null":stack.getDisplayName()));
if(stack != null)tag.setTag(i+"",stack.writeToNBT(tag));
}
pro.inventory = tag;
}
tag - это экземпляр nbt, который сохраняется.
- Краш-лог
-
java.lang.StackOverflowError
at java.io.DataOutputStream.writeByte(DataOutputStream.java:153) ~[?:1.7.0_67]
at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:469) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:37) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:474) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:37) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:474) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:37) ~[NBTTagCompound.class:?]
Краш-лог:
java.lang.StackOverflowError
at java.io.DataOutputStream.writeByte(DataOutputStream.java:153) ~[?:1.7.0_67]
at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:469) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:37) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:474) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:37) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.func_150298_a(NBTTagCompound.java:474) ~[NBTTagCompound.class:?]
at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:37) ~[NBTTagCompound.class:?]
Последнее редактирование: