Skip to content

fix: write client_command's actual field name (actionId, not action) - #3972

Open
liamnschermerhorn-code wants to merge 2 commits into
PrismarineJS:masterfrom
liamnschermerhorn-code:upstream/fix-client-command-field
Open

fix: write client_command's actual field name (actionId, not action)#3972
liamnschermerhorn-code wants to merge 2 commits into
PrismarineJS:masterfrom
liamnschermerhorn-code:upstream/fix-client-command-field

Conversation

@liamnschermerhorn-code

Copy link
Copy Markdown

The win_game handler in lib/plugins/game.js builds the packet with action, but the field is actionId in every protocol version's client_command definition. The intended value is therefore never written.

This is currently harmless rather than broken, and I want to be upfront about that: the missing field serialises as undefined, protodef writes that as 0, and 0 is exactly the value that was intended (perform_respawn). The packet has always come out correct by coincidence.

It is still wrong, and it is fragile — it only holds while the intended action is 0 and while undefined keeps coinciding with it. Worth writing the documented field name.

Verified the emitted bytes are unchanged on 26.1:

{ action: 0 }   -> 0c00
{ actionId: 0 } -> 0c00

So this is a no-op at the wire level today and purely a correctness fix. npx standard passes.

liamnschermerhorn-code and others added 2 commits August 21, 2026 19:35
The win_game handler builds the packet with `action`, but the field is `actionId`
in every protocol version's client_command definition. The intended value is
therefore never written.

This is currently harmless rather than broken: the missing field serialises as
undefined, which protodef writes as 0, and 0 happens to be the value that was
intended (perform_respawn). So the packet has always come out correct by
coincidence.

It is still wrong, and fragile -- it only works while the intended action is 0 and
while undefined keeps coinciding with it. Write the documented field name.

Verified the emitted bytes are unchanged on 26.1:
  { action: 0 }   -> 0c00
  { actionId: 0 } -> 0c00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants