Jump to content

[1.9]What's the logic to how NBT data is sorted?


Recommended Posts

This probably isn't 1.9 specific but I'm coding for 1.9. Let's say I have this code:


NBTTagCompound tag1 = new NBTTagCompound();
tag1.setString("alpha-string", "Alex");
tag1.setString("bravo-string", "John");


NBTTagCompound tag2 = new NBTTagCompound();
tag2.setString("charlie-string", "Chris");
tag2.setString("delta-string", "Bob");

NBTTagList tag3 = new NBTTagList();
tag3.appendTag(new NBTTagInt(3));
tag3.appendTag(new NBTTagInt(2));
tag3.appendTag(new NBTTagInt(1));

tag2.setTag("echo-tag-list", tag3);



Which prints this:




For the first compound tag the result makes sense, alpha-string was added before bravo-string and thus appears first. But for the second compound tag the result doesn't follow suit. echo-tag-list appears before delta-string despite being added after. Why is this?

I like trains.

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.

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.

  • Create New...

Important Information

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