BIG news: NBT Data

So, today, I am writing about something really, really big. Something we have been fighting with for a long, long time. Something I have basically already given up on some long time ago. But now, it’s here.

What is it?

NBT Data.

What the @$&#% is NBT data?

Big. Really Big. It’s the best. Really great. We have the best NBT Data in the whole world.

Sorry about that.Got into the mode of my day job…

NBT data is, increasingly everywhere. As you might know, every block/item in the game used to have a number (air is 0, cobblestone is 1 and so on). Then, there was a second number to define sub-types like wool color, damaged swords, egg spawn types and so on.

Then Mojang found that they cannot remember all the numbers after they added so many blocks and renamed all blocks from numbers to item names (like ‘air’, ‘stone’ etc). Then, they realized that they had too many subtypes. Since swords are not only damaged but also enchanted, potions, fireworks and banners can have several properties, you need more information than just another number. So they created NBT (Named Binary Tag).

We are using PHP for all the deposit, shop and so on, and to be able to use PHP for a game written in Java, you need an interface. Ours is called websend.

There are 2 issues with that. 1) The way minecraft stores the NBT data is a bloody mess. 2) Anyone who wants to get NBT data out of minecraft needs to sort out that mess. So Websend needs  to do the same. But they never really did. They did enchantements, used again a special format for it and then stopped there. So we never got anything else running but enchantments. In the meantime, even spawn eggs moved from numbers to NBT to indicate what mob would spawn, and they broke. Potions as well.

And then the solution came when Psiber got behind it and fixed Websend in about a full week of nerve-wrecking fiddling with the minecraft code, the websend code and another plugin that is supposed to solve NBT issues but is already included in a broken version in another plugin that we also use, so he could not use it again, and the format was wrong, and the quotes where encapsulated and whatnot other programmers nightmares.

Anyhow. You get the picture. And in the end he fixed it and I had valid NBT data in websend to use in PHP. Then, I had to go and look for every time we display item data, store item data, give items or take items from somewhere, and change the method so that it would not work only for the legacy enchantments format but for all NBT data.

Then I had to go into the shop and deposit and reformat all the existing stuff to the new NBT format so people could continue getting their lottery stuff and so on.

And now, it’s hopefully done. What does that mean?

We can use the following items in shops, deposits & lottery:

  • written books
  • potions
  • enchanted books & items
  • dyed armor
  • spawn eggs
  • named items
  • fireworks
  • shields & banners
  • any new item that mojang dreams up.

However we have actively blocked shulker boxes from being deposited (for obvious reasons).

What is left to do? A lot. some stuff more needed than others, some cool stuff as well.

  • We still have work to improve the display of items and how you can find them in the shop better than today. (e.g. search for enchantments or specific potion effects.
  • We have the option now to ‘copyright’ certain banners (as a donator perk for example) and then nobody else can create/use the same banner.
  • fix potential bugs (I have tried to test stuff, but I am not 100% sure if I got all the options).
  • Online editors for things like books (although this is complex in most cases)
  • Any other ideas?

Please be careful for the next couple of days with the shop & deposit. Please report to me immediately if something is not working 100% right. If there is an issue, make careful tests to make sure the issue is repeatable. Please don’t come to me saying you lost 100 diamonds because you tried the same issue 100 times and it still did not work.

Finally a big thanks to Psiber who helped making this possible!

 

 

10 thoughts on “BIG news: NBT Data

  1. Oh wow! Big deal!
    Thanks to you 2 so much and will think on reporting bugs if ever they will apear 🙂

  2. Thanks for all the hard work and countless hours of hair pulling.

  3. Good job! Was this related the bug I encountered the other day?

  4. Psiber gonna cyber.

    Awesome news Unc and Psi! Is there a place to see the changelog of everything that happened?

  5. My pleasure to be of assistance everyone. Just glad I could help in some way.

Comments are closed.