Skip to content

pc: fix entity_teleport packet structure for 1.21.4-1.21.11 (velocity, f32 yaw/pitch, relative flags) - #1251

Open
AnonymoDGH wants to merge 1 commit into
PrismarineJS:masterfrom
AnonymoDGH:fix/mcd-520
Open

AnonymoDGH wants to merge 1 commit into
PrismarineJS:masterfrom
AnonymoDGH:fix/mcd-520

Conversation

@AnonymoDGH

Copy link
Copy Markdown
Contributor

Fixes partial packet errors for entity_teleport on versions 1.21.4 through 1.21.11 (reported in mineflayer#3759: "Chunk size is 67 but only 33 was read" on 1.21.8).

The packet structure changed in 1.21.2 (per minecraft.wiki Synchronize Vehicle Position and confirmed against the NeoForge 1.21.5 javadoc for ClientboundTeleportEntityPacket): yaw/pitch became f32 (previously i8), and three new velocityX/Y/Z doubles plus a relative flags bitfield were added before onGround.

Verification: the reporter's actual packet buffer (768080808004c0...) previously decoded with only 33 of 67 bytes read; with this fix it decodes the full vanilla structure (entityId, x/y/z, velocityX/Y/Z, yaw/pitch, flags, onGround) — the remaining 2 bytes are a non-standard server (Wolfx) extension.

Complements PR #1154 (which covers 1.21.3) by applying the same fix to all later versions: 1.21.4, 1.21.5, 1.21.6, 1.21.8, 1.21.9, 1.21.11.

Verified: all 6 versions regenerate cleanly (yaml/json in sync); protocolSync passes.

@rom1504 rom1504 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astra agent review — AI-generated, not manually written by the maintainer.

The expanded teleport layout still under-reads its flags field: nine one-bit entries occupy two bytes, whereas vanilla’s relative-position mask is a four-byte integer. That accounts for the two trailing bytes described here, so they should not be dismissed as a server extension. Please use the existing 32-bit relative-flags representation consistently in the YAML and generated JSON, and validate the complete captured packet consumption before landing.

Coordinate the same repair in #1154. This is a current schema/width finding carried from the earlier review, not a new live server run.

Skills used: prismarine-review checked the current revision and discussion; prismarine-protocol-data-review checked the version-selected producer/consumer contract; prismarine-architecture-review checked package ownership and integration scope.

Comment thread data/pc/1.21.11/proto.yml
velocityZ: f64
yaw: f32
pitch: f32
flags: ["bitfield", [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astra agent review — AI-generated, not manually written by the maintainer.

Nine one-bit members make this field two bytes, but vanilla Relative.SET_STREAM_CODEC uses a four-byte integer. This leaves two bytes unconsumed and shifts onGround; the same pattern is repeated in the other five YAML files. Please reuse the existing PositionUpdateRelatives bitflags/u32 representation and rebuild the JSON. Validate the complete packet, including a nonzero high flag, rather than interpreting the trailing bytes as an extension.

Skills used: prismarine-protocol-data-review checked the native wire width and packet boundary; prismarine-architecture-review identified the existing reusable type.

This branch has not been deployed

No deployments
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