-
Notifications
You must be signed in to change notification settings - Fork 29
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
Mixed list; string as compound #97
Comments
I guess it could, but this doesn't seem correct in the sense that simplify is no longer removing type wrappers but changing the underlying data structure. This could be a problem as it breaks creating a potential reverse simplify() function in the future. |
I consider the |
Related to what I mentioned is #39. Turning to string is a completely different type than an object with one key in it, and it's not something that can be extended as a primitive type. |
Thank you for clarifying. In that case I agree that it may be better to strictly stick with the NBT spec here and deal with the use of the hack one level higher in prismarine-chat and wherever else it may show up. |
In the 1.20 protocol, most chat is represented as NBT. Chat has several situations (translate, extra) where an array can contain either more chat elements, or simple strings. In this case, Mojang represents strings as compounds with a single
""
key:Show example
My use case is converting the chat NBT to the old format:
new ChatMessage(NBT.simplify(packet.message))
To solve this,
simplify()
could convert{ "": { "type": "string", "value": "some text" } }
to"some text"
.This would also eliminate the need for special handling via
processNbtMessage
etc.Related:
PrismarineJS/prismarine-chat#103
PrismarineJS/prismarine-chat#104
The text was updated successfully, but these errors were encountered: