diff --git a/pumpkin-protocol/src/client/play/c_teleport_entity.rs b/pumpkin-protocol/src/client/play/c_teleport_entity.rs new file mode 100644 index 000000000..01722a6c0 --- /dev/null +++ b/pumpkin-protocol/src/client/play/c_teleport_entity.rs @@ -0,0 +1,38 @@ +use pumpkin_macros::packet; +use serde::Serialize; + +use crate::VarInt; + +#[derive(Serialize)] +#[packet(0x70)] +pub struct CTeleportEntitiy { + entity_id: VarInt, + x: f64, + y: f64, + z: f64, + yaw: u8, + pitch: u8, + on_ground: bool, +} + +impl CTeleportEntitiy { + pub fn new( + entity_id: VarInt, + x: f64, + y: f64, + z: f64, + yaw: u8, + pitch: u8, + on_ground: bool, + ) -> Self { + Self { + entity_id, + x, + y, + z, + yaw, + pitch, + on_ground, + } + } +} diff --git a/pumpkin-protocol/src/client/play/mod.rs b/pumpkin-protocol/src/client/play/mod.rs index c64720948..90a405280 100644 --- a/pumpkin-protocol/src/client/play/mod.rs +++ b/pumpkin-protocol/src/client/play/mod.rs @@ -32,6 +32,7 @@ mod c_spawn_player; mod c_subtitle; mod c_sync_player_position; mod c_system_chat_message; +mod c_teleport_entity; mod c_unload_chunk; mod c_update_entity_pos; mod c_update_entity_pos_rot; @@ -73,6 +74,7 @@ pub use c_spawn_player::*; pub use c_subtitle::*; pub use c_sync_player_position::*; pub use c_system_chat_message::*; +pub use c_teleport_entity::*; pub use c_unload_chunk::*; pub use c_update_entity_pos::*; pub use c_update_entity_pos_rot::*; diff --git a/pumpkin/src/client/player_packet.rs b/pumpkin/src/client/player_packet.rs index b27af67cd..246702d41 100644 --- a/pumpkin/src/client/player_packet.rs +++ b/pumpkin/src/client/player_packet.rs @@ -41,8 +41,8 @@ impl Player { _server: &mut Server, confirm_teleport: SConfirmTeleport, ) { - if let Some(id) = self.awaiting_teleport.clone() { - if id == confirm_teleport.teleport_id { + if let Some(id) = self.awaiting_teleport.as_ref() { + if id == &confirm_teleport.teleport_id { } else { log::warn!("Teleport id does not match, Weird but okay"); }