[SPIGOT-5822] ItemStacks serialized with attributes prior to 1.16 lose their attributes in 1.16.1 Created: 25/Jun/20 Updated: 27/Jun/20 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Nathan Wolf | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 4 |
Labels: | 1.16.1, attribute | ||
Environment: |
Mac OS |
Attachments: |
![]() ![]() |
Version: | git-Spigot-758abbe-3f0c333 (MC: 1.16.1) |
Guidelines Read: | Yes |
Description |
This looks like a similar problem to 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==
|
Comments |
Comment by md_5 [ 27/Jun/20 ] |
Yes there will still be this problem now, but there won't be similar problems in 1.17 etc |
Comment by Nathan Wolf [ 27/Jun/20 ] |
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). |
Comment by Ross [ 27/Jun/20 ] |
You can reflect out the NBT string itself instead of dumping to YAML. |
Comment by md_5 [ 26/Jun/20 ] |
Honestly we should have an nbt2yaml serializer for this purpose, of course that doesn't fix older items |
Comment by Nathan Wolf [ 26/Jun/20 ] |
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? |
Comment by md_5 [ 26/Jun/20 ] |
The ItemStack to YAML serialisation is trash |