-
-
Notifications
You must be signed in to change notification settings - Fork 247
Fix 1.21.10 spawn_entity and entity_velocity packet structures #1119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: pc-1_21_10
Are you sure you want to change the base?
Fix 1.21.10 spawn_entity and entity_velocity packet structures #1119
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.
|
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
|
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 |
|
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 |
|
@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. |
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