ItemStacks serialized with attributes prior to 1.16 lose their attributes in 1.16.1

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Environment:

      Mac OS

    • git-Spigot-758abbe-3f0c333 (MC: 1.16.1)
    • Yes

      This looks like a similar problem to SPIGOT-4576

      Serialized ItemStacks with attributes lose their attributes in 1.16. Internal MC code prints an error "Unable to create attribute: null", meaning an NPE was thrown inside of nms.AttributeModifier.a(NBTTagCompound).

      My best guess is that it's missing the minecraft: prefix on the Mojang attribute type, judging by the before and after shown in the attached screenshots (these attributes were created separately on each version, not deserialized, to see what they should look like)

      Here is an example of an item serialized in older versions of Spigot that now throws this error:

      item:
        ==: org.bukkit.inventory.ItemStack
        type: GOLD_SWORD
        damage: 7
        meta:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          display-name: Emerald Sword
          Unbreakable: true
          internal: H4sIAAAAAAAAAONiYOBkEHIsKSnKTCotSfXNT8lMy0wtKuZiYGBgYmHgCA31dPHNLy75pWwn49jgkcrCwAkS8klNLC7ZIL3n3PTWNYvZGNgcc/NL80ocGCCAg4ElOCe/hIEjNzEzLyMxL4WDgRduhV9ibiqDcHpqXmpRZrJeYklJYnJ2cEFqagozA6d/QWpRYklmfh7UFLBaIdfC0syC3NS8EgWY8xiQXHbaPvRySoy/BbLLlkyfI7zYdut5hMsUiHWZCKrLXBJzE9NTSXEaAwCwmFFiUwEAAA==
      
      

       

          [SPIGOT-5822] ItemStacks serialized with attributes prior to 1.16 lose their attributes in 1.16.1

          md_5 added a comment -

          Yes there will still be this problem now, but there won't be similar problems in 1.17 etc

          md_5 added a comment - Yes there will still be this problem now, but there won't be similar problems in 1.17 etc

          Nathan Wolf added a comment -

          Wouldn't either of those two solutions still run into this same problem, though?

           

          Unless we are able to expose the Mojang NBT migration code (or use it under the hood).

          Nathan Wolf added a comment - Wouldn't either of those two solutions still run into this same problem, though?   Unless we are able to expose the Mojang NBT migration code (or use it under the hood).

          Ross added a comment -

          You can reflect out the NBT string itself instead of dumping to YAML.

          Ross added a comment - You can reflect out the NBT string itself instead of dumping to YAML.

          md_5 added a comment -

          Honestly we should have an nbt2yaml serializer for this purpose, of course that doesn't fix older items

          md_5 added a comment - Honestly we should have an nbt2yaml serializer for this purpose, of course that doesn't fix older items

          Nathan Wolf added a comment -

          Sorry

          It seems like any kind of item persistence outside of an actual MC world is going to problematic since we can't run native migration code on the items when the server gets updated.

          I guess there's no real alternative for saving items and providing items built into a plugin, besides Yaml serialization? 

          Nathan Wolf added a comment - Sorry It seems like any kind of item persistence outside of an actual MC world is going to problematic since we can't run native migration code on the items when the server gets updated. I guess there's no real alternative for saving items and providing items built into a plugin, besides Yaml serialization? 

          md_5 added a comment -

          The ItemStack to YAML serialisation is trash

          md_5 added a comment - The ItemStack to YAML serialisation is trash

            Assignee:
            Unassigned
            Reporter:
            Nathan Wolf
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: