bot._client.on 'sync_entity_position' changes entity.pitch and entity.yaw to wrong value #3622
Open
1 task done
Labels
possible bug
Stage1
just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Uh oh!
There was an error while loading. Please reload this page.
Versions
Detailed description of a problem
The pitch and yaw of an entity (in this case another player) doesn't get updated correctly, when the client receives
sync_entity_position
. (Seems to be send when the entity/player jumps or moves down from a block)The pitch and yaw gets corrected, once the entity looks somewhere else and the
entity_look
orentity_move_look
packages are processed.This makes accurate tracking of the looking direction of e.g. a player impossible.
Minimal example
This will log something like this.:
The first change (to -71 and -5) happened after the player pressed space to jump, and the second change (back to (4 and 0) happened after the player moved the mouse aka. looked around.
Expected behavior
The yaw and pitch should not change when jumping or moving down blocks / when that package gets send.
Possible Solution
I don't know what exactly the package
sync_entity_position
does, but it appears that the send yaw and pitch are neither radians nor the notchianYawBytes, but degrees instead (as seen in the F3 Debug menu). So they need to be converted into radians before being written to the entity.yaw and entity.pitch.So the current code:
mineflayer/lib/plugins/entities.js
Lines 345 to 353 in 2b6bd7d
Should be modified like this:
That way the log from above will look something like this:
There is still a change in the yaw and pitch, but I think that's just because of the conversion from degree to radians and should be tolerable.
I also don't know if and how this affects 1.21.3 as it seems that that function was created for 1.21.3 specifically but apparently gets used by 1.21.4 as well.
The text was updated successfully, but these errors were encountered: