From a081c73215328812df40e2967269a7e48a976b89 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sat, 11 May 2019 14:53:42 -0700 Subject: [PATCH] 1.7.10: Fix player position too high on login. Closes #87 Adds a new TeleportPlayer_NoGround packet, which is subtly different from TeleportPlayer_NoConfirm. The flags u8 is replaced with an on_ground bool, but more importantly the Y position is the eyes position, so we have to translate to feet position for the client. 1.7.10: https://wiki.vg/index.php?title=Protocol&oldid=6003#Player_Position_And_Look 1.8.9: https://wiki.vg/index.php?title=Protocol&oldid=7368#Player_Position_And_Look --- protocol/src/protocol/packet.rs | 8 ++++++++ protocol/src/protocol/versions/v1_7_10.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/protocol/src/protocol/packet.rs b/protocol/src/protocol/packet.rs index 21b0615..6fb57e9 100644 --- a/protocol/src/protocol/packet.rs +++ b/protocol/src/protocol/packet.rs @@ -1310,6 +1310,14 @@ state_packets!( field pitch: f32 =, field flags: u8 =, } + packet TeleportPlayer_OnGround { + field x: f64 =, + field eyes_y: f64 =, + field z: f64 =, + field yaw: f32 =, + field pitch: f32 =, + field on_ground: bool =, + } /// EntityUsedBed is sent by the server when a player goes to bed. packet EntityUsedBed { field entity_id: VarInt =, diff --git a/protocol/src/protocol/versions/v1_7_10.rs b/protocol/src/protocol/versions/v1_7_10.rs index 1bc92ff..c930e42 100644 --- a/protocol/src/protocol/versions/v1_7_10.rs +++ b/protocol/src/protocol/versions/v1_7_10.rs @@ -42,7 +42,7 @@ protocol_packet_ids!( 0x05 => SpawnPosition_i32 0x06 => UpdateHealth_u16 0x07 => Respawn - 0x08 => TeleportPlayer_NoConfirm + 0x08 => TeleportPlayer_OnGround 0x09 => SetCurrentHotbarSlot 0x0a => EntityUsedBed_i32 0x0b => Animation