Add Clientbound Teleport Entity
usually used when Player moves more than 8 blocks
This commit is contained in:
1 parent
f40eb85c53
commit
d69f6c5fc1
3 files changed
+42
-2
No files matched your search
@@ -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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,6 +32,7 @@ mod c_spawn_player;
|
|||||||
mod c_subtitle;
|
mod c_subtitle;
|
||||||
mod c_sync_player_position;
|
mod c_sync_player_position;
|
||||||
mod c_system_chat_message;
|
mod c_system_chat_message;
|
||||||
|
mod c_teleport_entity;
|
||||||
mod c_unload_chunk;
|
mod c_unload_chunk;
|
||||||
mod c_update_entity_pos;
|
mod c_update_entity_pos;
|
||||||
mod c_update_entity_pos_rot;
|
mod c_update_entity_pos_rot;
|
||||||
@@ -73,6 +74,7 @@ pub use c_spawn_player::*;
|
|||||||
pub use c_subtitle::*;
|
pub use c_subtitle::*;
|
||||||
pub use c_sync_player_position::*;
|
pub use c_sync_player_position::*;
|
||||||
pub use c_system_chat_message::*;
|
pub use c_system_chat_message::*;
|
||||||
|
pub use c_teleport_entity::*;
|
||||||
pub use c_unload_chunk::*;
|
pub use c_unload_chunk::*;
|
||||||
pub use c_update_entity_pos::*;
|
pub use c_update_entity_pos::*;
|
||||||
pub use c_update_entity_pos_rot::*;
|
pub use c_update_entity_pos_rot::*;
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ impl Player {
|
|||||||
_server: &mut Server,
|
_server: &mut Server,
|
||||||
confirm_teleport: SConfirmTeleport,
|
confirm_teleport: SConfirmTeleport,
|
||||||
) {
|
) {
|
||||||
if let Some(id) = self.awaiting_teleport.clone() {
|
if let Some(id) = self.awaiting_teleport.as_ref() {
|
||||||
if id == confirm_teleport.teleport_id {
|
if id == &confirm_teleport.teleport_id {
|
||||||
} else {
|
} else {
|
||||||
log::warn!("Teleport id does not match, Weird but okay");
|
log::warn!("Teleport id does not match, Weird but okay");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user