1.7.10: Fix sending head/feet player position, #87

1.8+ removes the player head position, and sends only the feet position.
We store the feet position internally in the client, so the head
position has to be calculated, normally 1.62 units higher. Previously
the calculation was reversed, which caused the client to show its
position as 1.62 units higher than the server, and the server would
correct the position when the client descends to the ground.

1.7.10: https://wiki.vg/index.php?title=Protocol&oldid=6003#Player_Position
1.8.9: https://wiki.vg/index.php?title=Protocol&oldid=7368#Player_Position
This commit is contained in:
ice_iix 2019-05-11 14:24:41 -07:00
parent c8e13c38bd
commit a159355751
1 changed files with 2 additions and 2 deletions

View File

@ -551,8 +551,8 @@ impl Server {
} else {
let packet = packet::play::serverbound::PlayerPositionLook_HeadY {
x: position.position.x,
feet_y: position.position.y - 1.62,
head_y: position.position.y,
feet_y: position.position.y,
head_y: position.position.y + 1.62,
z: position.position.z,
yaw: -(rotation.yaw as f32) * (180.0 / PI),
pitch: (-rotation.pitch as f32) * (180.0 / PI) + 180.0,