-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
NBT Component Serializer #1084
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please review what the game actually does, you've dragged over so much legacy baggage that'd be completely unnecessary if you actually thought things through
...rializer-nbt/src/main/java/net/kyori/adventure/text/serializer/nbt/NBTSerializerOptions.java
Show resolved
Hide resolved
...alizer-nbt/src/main/java/net/kyori/adventure/text/serializer/nbt/NBTComponentSerializer.java
Outdated
Show resolved
Hide resolved
...rializer-nbt/src/main/java/net/kyori/adventure/text/serializer/nbt/ClickEventSerializer.java
Outdated
Show resolved
Hide resolved
...rializer-nbt/src/main/java/net/kyori/adventure/text/serializer/nbt/HoverEventSerializer.java
Outdated
Show resolved
Hide resolved
I've added a possibility to (de)-serialize a style without a component, because it's useful for new chat type registry in Minecraft. For example Minestom uses adventure styles to (de)-serialize the chat type styles. |
text-serializer-nbt/src/main/java/net/kyori/adventure/text/serializer/nbt/StyleSerializer.java
Outdated
Show resolved
Hide resolved
After ~ 3 months i can say that it's stable. I've not noticed any issues with the serializer. I was using it in my server software - Jet - for that time. I tested all functionality, including item data components etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally speaking I'm happy with this. My only slight concern is that there's a lot of unchecked casts. I do wonder if we might be better off handling all of these and throwing nicer error messages (e.g. Expected <tag> to be of type Byte, was String
)?
I don't think this is a blocker on a merge though, happy for this to go through and leave an issue for us to come back to that later.
Yeah, but in my opinion that should be done in adventure nbt instead. |
How could that be done in adventure-nbt? |
Making method such as |
I don't think that makes sense for an API. |
This comment has been minimized.
This comment has been minimized.
Any update on this PR? There haven't been any commits in over eight months. Is this still happening? |
The PR was complete, however nobody has merged it. Now it's not, the only thing missing is the shadow colors feature from new Minecraft versions, i'm going to add it soon. |
Adds a support for serializing components as NBT Binary Tags.
Resolves #995