Add Player movement
This commit is contained in:
1 parent
32569bafe5
commit
eb18873960
13 files changed
+246
-53
No files matched your search
@@ -0,0 +1,20 @@
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[packet(0x48)]
|
||||
pub struct CHeadRot {
|
||||
entity_id: VarInt,
|
||||
head_yaw: u8,
|
||||
}
|
||||
|
||||
impl CHeadRot {
|
||||
pub fn new(entity_id: VarInt, head_yaw: u8) -> Self {
|
||||
Self {
|
||||
entity_id,
|
||||
head_yaw,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ pub struct CSpawnEntity {
|
||||
}
|
||||
|
||||
impl CSpawnEntity {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
entity_id: VarInt,
|
||||
entity_uuid: uuid::Uuid,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[packet(0x2F)]
|
||||
pub struct CUpdateEntityPosRot {
|
||||
entity_id: VarInt,
|
||||
delta_x: i16,
|
||||
delta_y: i16,
|
||||
delta_z: i16,
|
||||
yaw: u8,
|
||||
pitch: u8,
|
||||
on_ground: bool,
|
||||
}
|
||||
|
||||
impl CUpdateEntityPosRot {
|
||||
pub fn new(
|
||||
entity_id: VarInt,
|
||||
delta_x: i16,
|
||||
delta_y: i16,
|
||||
delta_z: i16,
|
||||
yaw: u8,
|
||||
pitch: u8,
|
||||
on_ground: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
entity_id,
|
||||
delta_x,
|
||||
delta_y,
|
||||
delta_z,
|
||||
yaw,
|
||||
pitch,
|
||||
on_ground,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[packet(0x2E)]
|
||||
pub struct CUpdateEntityPos {
|
||||
entity_id: VarInt,
|
||||
delta_x: i16,
|
||||
delta_y: i16,
|
||||
delta_z: i16,
|
||||
on_ground: bool,
|
||||
}
|
||||
|
||||
impl CUpdateEntityPos {
|
||||
pub fn new(
|
||||
entity_id: VarInt,
|
||||
delta_x: i16,
|
||||
delta_y: i16,
|
||||
delta_z: i16,
|
||||
on_ground: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
entity_id,
|
||||
delta_x,
|
||||
delta_y,
|
||||
delta_z,
|
||||
on_ground,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[packet(0x30)]
|
||||
pub struct CUpdateEntityRot {
|
||||
entity_id: VarInt,
|
||||
yaw: u8,
|
||||
pitch: u8,
|
||||
on_ground: bool,
|
||||
}
|
||||
|
||||
impl CUpdateEntityRot {
|
||||
pub fn new(entity_id: VarInt, yaw: u8, pitch: u8, on_ground: bool) -> Self {
|
||||
Self {
|
||||
entity_id,
|
||||
yaw,
|
||||
pitch,
|
||||
on_ground,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
mod c_change_difficulty;
|
||||
mod c_chunk_data_update_light;
|
||||
mod c_game_event;
|
||||
mod c_head_rot;
|
||||
mod c_login;
|
||||
mod c_play_disconnect;
|
||||
mod c_player_abilities;
|
||||
@@ -9,11 +10,15 @@ mod c_set_held_item;
|
||||
mod c_spawn_player;
|
||||
mod c_sync_player_position;
|
||||
mod c_system_chat_message;
|
||||
mod c_update_entitiy_pos_rot;
|
||||
mod c_update_entity_pos;
|
||||
mod c_update_entity_rot;
|
||||
mod player_action;
|
||||
|
||||
pub use c_change_difficulty::*;
|
||||
pub use c_chunk_data_update_light::*;
|
||||
pub use c_game_event::*;
|
||||
pub use c_head_rot::*;
|
||||
pub use c_login::*;
|
||||
pub use c_play_disconnect::*;
|
||||
pub use c_player_abilities::*;
|
||||
@@ -22,4 +27,7 @@ pub use c_set_held_item::*;
|
||||
pub use c_spawn_player::*;
|
||||
pub use c_sync_player_position::*;
|
||||
pub use c_system_chat_message::*;
|
||||
pub use c_update_entitiy_pos_rot::*;
|
||||
pub use c_update_entity_pos::*;
|
||||
pub use c_update_entity_rot::*;
|
||||
pub use player_action::*;
|
||||
Reference in new issue
Block a user