Custom data failure

In light that an old thread of mine around this topic having died and the topic having distinctly moving to a different issue I am posting again. For a full evolution of what has happened regarding this custom data you can view the very long and boring thread here.

A TLDR is as folows, before API 7 I used custom data on items that was then offered by pixelmon shop keepers. When custom data changed slightly when moving to API 7 the code I had broke. During the course of that thread I was helped into getting the data implemented correctly to work on API 7. Now this is where my current issue was found.

When using this custom data spawning the items in from plugin code all is well. However spawning these items from the pixelmon shop keepers using the correct data has “interesting” results. The items spawned from the pixelmon shop keepers instead of having the NBT tags as normal the tags are inside a catagory called “FailedData” instead of “CustomManipulators” and it shows up twice. Now to add to the weirdness when logging out and logging back in again with one of these weird items in your inventory it seems sponge tries to fix this. This then leaves the item with 2 entry’s of the data under “FailedData” and one correct entry under “CustomManipulators”. I will post images from breakpoint below so you can see the tags.

Item immediately after being spawned by pixelmon NPC (Note two exact copies of the data under “FailedData”)
image

Item spawned by pixelmon NPC after log out then log in with item in inventory (Note a final 3rd copy of the data under “CustomManipulators”)
image

The good news is that when the data is in “CustomManipulators” everything works fine however its a pain in the ass and obviously something is screwing up somewhere. If anyone can help me detect failed data, removing it and putting it under “CustomManipulators” if required that would be a nice quick fix. Otherwise I won’t pretend I am particularly skilled with the custom data implementation of sponge if anyone can think of an error I made or perhaps see one in the code would be amazing. Gabizou mentioned some errors I made in the last thread however I don’t understand what I am supposed to do to fix this as I followed a template to implement the data, if anyone could elaborate and help me understand would be much appreciated.

Code can be found on github here

Thanks for reading :slight_smile:

Had the same problem: https://github.com/SpongePowered/SpongeCommon/issues/1683

But should be fixed by now.

Maybe this will be relevant too in future, if you’re dealing with old data: https://github.com/SpongePowered/SpongeCommon/issues/1859