pc: fix custom_click_action NBT to use a VarInt length prefix - #1230
Open
AnonymoDGH wants to merge 1 commit into
Open
pc: fix custom_click_action NBT to use a VarInt length prefix#1230AnonymoDGH wants to merge 1 commit into
AnonymoDGH wants to merge 1 commit into
Conversation
Contributor
Author
|
Note on CI: the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1222
Problem
packet_common_custom_click_actiondeclared its NBT field as:which encodes it as an optional value with a boolean prefix. The actual wire format used by the vanilla client (and expected by BungeeCord) is:
BungeeCord reads it via
readLengthPrefixed(...)(CustomClickAction.java), i.e. a VarInt length followed by the NBT bytes — there is no optional sentinel. With the old schema the client wrote01 0A 0B ...(BungeeCord read01as the payload length and the NBT decoder failed withException reading tag), and writing the NBT without any prefix (0A 0B ...) is also invalid.Fix
Changed the field to a VarInt-length-prefixed buffer in every affected version — the exact representation verified in the issue to produce byte-identical output to the vanilla client:
Applied to
data/pc/1.21.6,1.21.8,1.21.9,1.21.11andlatest(all of which carried the same incorrect definition), and regenerated the correspondingprotocol.jsonfiles (1.21.6,1.21.8,1.21.9,1.21.11,26.1) withnpm run build.Verified
CustomClickAction(readLengthPrefixed/writeLengthPrefixed→ VarInt length + NBT, always present).protocolSynctest passes: all proto.yml files are valid and in sync with their protocol.json.protocol.jsondiffs contain only thenbtfield change.