Paper: Issue with Item Name in new Serialization API to byte[]

Created on 21 May 2020  路  4Comments  路  Source: PaperMC/Paper

Thanks for the new ItemStack serialization API introduced in build 298 - it should solve many issues I currently have with the Bukkit ItemStack serialization. I just played around with it considering to migrate my plugin and discovered that there is an Issue serializing/deserializig custom ItemStack names. Would be great to get it fixed!

What behaviour is expected:

Serializing and then deserializing a named item should result in an identical ItemStack

What behaviour is observed:

When serializing and then deserializing a named item, the name contains the entire JSON object instead of just the text.

Steps/models to reproduce:

Take an ItemStack with a custom name (either by Plugin or a native one like an ominous banner). Then serialize it via ItemStack#serializeAsBytes() followed by ItemStack.deserializeBytes(...).

Paper build number:

Paper version git-Paper-304 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)

Anything else:

Examples after deserialization:

2020-05-21_14 37 42
2020-05-21_14 37 46

Most helpful comment

Dangit forgot to pass that dataVersion variable in place of that -1.

All 4 comments

The same issue occurs with the content of a Book and Quill. In contrast, already signed books are identical to the original stack as expected.

2020-05-21_14 45 39

Dangit forgot to pass that dataVersion variable in place of that -1.

Thanks for the quick fix!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Brokkonaut picture Brokkonaut  路  3Comments

BillyGalbreath picture BillyGalbreath  路  3Comments

tazuuuu picture tazuuuu  路  3Comments

successed picture successed  路  3Comments

ShelLuser picture ShelLuser  路  3Comments