PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

handle the server resending the rotation of the bot #993

Closed rom1504 closed 4 years ago

rom1504 commented 4 years ago

there https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/physics.js#L373

probably needed to check the flags for this, see https://wiki.vg/Protocol#Player_Position_And_Look_.28clientbound.29

Karang commented 4 years ago

I had a look to fix the issue, but it seems like this is the normal behavior.

The server is sending a player position and look packet containing the correct yaw and pitch and mineflayer update it correctly. But other players are seeing the freshly spawned bot looking at yaw = 0 until the bot start moving. This is also the case when a player with a vanilla client spawn, if he don't move his mouse, other players will see the character looking at yaw = 0. Somehow the pitch is correct...

A workarround would be to immediately send a position and look packet to the server with a slightly different yaw (like yaw+0.001, the server will only send the update to other players if it detect a change).

As it is vanilla behavior, I suggest to leave it as it is and this issue can be closed.