-
-
Notifications
You must be signed in to change notification settings - Fork 134
NBT Component Serializer #1084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main/4
Are you sure you want to change the base?
NBT Component Serializer #1084
Conversation
…f stuff after spigotting (looking at nms code decompiled and mapped with build tools)
The serialization works now, but i need to clean it up, add backwards compatibility (old nbt), add javadocs and deserialization. But the hardest part with understanding how everything realted to this (in both adventure and Minecraft) is done. |
Component deserialization works properly (tested with a large component with many children and styling), component serialization however doesn't serialize lists of components (children, etc.) as anything else than compounds. I'll check if there's a way to make it check if all types of components can be serialized as a string without looping through the entire list twice (one time for checks, second time for creating the list). What's left (let me know if i forgot anything):
|
Another TODO: |
…ion instead of returning null
I forgot to add tests for hover event and click event, i'm adding them right now |
Ok, it's ready now, i think |
…ll annotations instead
…lizing from lists does not support heterogeneous lists
I added support for deserializing legacy hover events (those where contents are serialized as text components) as they were still valid for vanilla component serializer while deserializing in versions with NBT component serializing and camel case hover events, however serialization is not supported. I did it like that since I want to make this serializer work the same as the vanilla one, so developers can easily switch to this serializer. |
I'd say this serializer is done. It's definitely better than the previous one, it also follows new approach used in the GSON serializer - vanilla-like output. There is one thing left (output comparisons with the dfu serializer) in a list posted by me few comments above, however I'm going to do that in a different repo and it's more like a "proof" that the serializer is stable and world properly and it shouldn't block the PR from being marked as "ready". |
Oh, I just realized that there are checkstyle errors, I'm going to fix them soon |
All of the checkstyle errors have been fixed. |
Btw, you probably want to squash-merge this PR since it has over 80 commits ( 😮 ). |
The latest commit fixes the order in which |
Tests comparing 23w40a (first Minecraft version serializing components in NBT) serializer and this serializer's output are running successfully (https://github.com/Codestech1/nbt-dfu-comparison). Now I only need to copy-paste these tests, replace the testing version to 1.21.7, remove legacy features from testing components and add tests for new features. |
…zerOptions#EMIT_SHADOW_COLOR, fix: versioned option state of NBTSerializerOptions serializes shadow color as a list by default
Ok, now the dfu comparison tests are complete (they're available here). All issues have been fixed, the output is the same as in vanilla, so there is really no need to test it in-game. I'd say it's stable enough, hopefully this gets merged soon, the PR is now fully completed. All you need to run these tests is to publish adventure (on the branch associated with this PR) to maven local. |
Adds a support for serializing components as NBT Binary Tags.
Resolves #995