Snapshot 25w20a uses a rather weird format for submitting dialogs to the server:
minecraft:custom_form
- This method will build a custom server click action from all values and request the server to run it (same as
minecraft:customclick event)- Format:
- keys are separated from values with horizontal tabulation (
U+0009) character- key-value entries are separated with line feed (
U+000A) character- If characters
U+0009andU+000Aare present in any key or value, they will be escaped to\tand\n
This TSV-like format is also somewhat error prone, and doesn't exactly match what most CSV parsers have. I had to write a test suite to make sure my parser implementation is correct and as strict as possible, as there are a few edge cases that need to be handled properly. I believe if this is implemented, consumers of this data should unify on a parser implementation library rather than parse it themselves.
This seems strange to me, since JSON and NBT are already available in the protocol. Pretty much all server implementations already have Gson available in the classpath for plugins and mods. Why deviate from this? Perhaps it's more DoS resistant since limiting the total length does a good job at preventing DoS even for a naive parser implementation, but JSON parsers typically already have good functionality for configuring a depth limit.
Another alternative would be to use IBM-style tabulated documents, making use of 0x1F UNIT SEPARATOR, 0x1E RECORD SEPARATOR, and 0x1D GROUP SEPARATOR.
Please sign in to leave a comment.
1 Comments