Jump to content

NBT stackoverflow


Russoul

Recommended Posts

I'm always getting this error when trying to save my entity extended properties to 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:?]

 

 

Code:

 

public static void saveInventoryToExtendedProps(EntityPlayer player, InventoryEX inv){
            InventoryProperties props = 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));
            }
            props.inventory = tag;
}

 

tag is an nbt instance that is being saved.

 

What's wrong here ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.