Fix 1.21.10 spawn_entity and entity_velocity packet structures#1119
Closed
micahstubbs wants to merge 3 commits intoPrismarineJS:pc-1_21_10from
Closed
Fix 1.21.10 spawn_entity and entity_velocity packet structures#1119micahstubbs wants to merge 3 commits intoPrismarineJS:pc-1_21_10from
micahstubbs wants to merge 3 commits intoPrismarineJS:pc-1_21_10from
Conversation
Building on PR PrismarineJS#1118's packet ID mapping fixes, this commit addresses additional packet structure issues discovered during testing: 1. spawn_entity: Remove velocity fields (velocityX/Y/Z) - Server packets are ~5 bytes shorter than expected - Velocity fields appear to be removed or sent differently in 1.21.10 - Use restBuffer to handle any remaining data gracefully 2. entity_velocity: Same treatment for consistency - The i16 velocity fields cause parse errors - Replace with restBuffer to avoid PartialReadError These fixes were discovered while debugging mineflayer/mindcraft bot connectivity to a 1.21.10 server. Raw packet captures confirmed the shorter packet sizes. References: - PR PrismarineJS#1118: Packet ID mapping fixes - Tested with actual 1.21.10 server (protocol 773)
…elocity fixes - Created proto.yml for 1.21.10 based on 1.21.8 - Removed velocity fields from packet_spawn_entity (not sent in 1.21.10) - Updated packet_entity_velocity to use restBuffer (format changed in 1.21.10) - Updated dataPaths.json to point proto to pc/1.21.10 - Regenerated protocol.json using npm run build in tools/js This follows the proper YAML-based contribution workflow.
Author
|
Thanks for the feedback @rom1504. I've updated this PR to follow the proper workflow:
The changes are now properly based on YAML source. Let me know if there's anything else that needs adjustment. |
- Added 5 placeholder packets (0x26-0x2a) to shift keep_alive to 0x2b and login to 0x30 - This matches the actual 1.21.10 protocol behavior observed in testing - Bot now works without runtime fix scripts
Author
|
Added packet ID mapping fixes:
Tested successfully with a mineflayer bot connecting to a Minecraft 1.21.10 server. |
|
is it able to open guis without crashing |
Contributor
|
I believe 1.21.10 is just a minor hot fix release. The major protocol changes happened in 1.21.9 I am trying to fix here |
Author
|
@chiterl, yes but still has warnings. trying to fix those warnings before marking this as ready for review. @richnetdesign oh! will check your PR. thanks for pointing that out. |
Member
|
Done in #1096 |
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.
Summary
First, thank you to the PrismarineJS maintainers for this incredible project. The mineflayer/minecraft-protocol ecosystem has been invaluable for our work on AI-powered Minecraft bots.
Problem
When connecting a mineflayer bot to a 1.21.10 server, we encountered
PartialReadError: Read error for undefined : undefinederrors when parsingspawn_entityandentity_velocitypackets. The errors occurred at thei16reader for velocity fields.Root Cause Investigation
We captured raw packet bytes and manually parsed them:
The packets are ~5 bytes shorter than expected, indicating the velocity fields (velocityX, velocityY, velocityZ) are no longer included in 1.21.10.
Changes
restBufferto handle remaining dataTesting
Note
We noticed PR #1118 has keep_alive at 0x2a, while our testing showed 0x2b works correctly. This might warrant further investigation, but we wanted to keep this PR focused on the structure fixes. Happy to help debug the packet ID mapping further if needed.
Related