diff --git a/src/packets/client.rs b/src/packets/client.rs index fd42df0..5764e6f 100644 --- a/src/packets/client.rs +++ b/src/packets/client.rs @@ -8,8 +8,11 @@ mod play; mod player_abilities; mod registry_data; mod set_default_spawn_position; +mod spawn_entity; mod status_response; mod synchronize_player_position; +mod teleport_entity; +mod update_entity_position; pub use chunk_data_and_update_light::{BlockEntity, ChunkDataAndUpdateLight}; pub use finish_configuration::FinishConfigurationClientbound; @@ -19,5 +22,8 @@ pub use play::{DeathInfo, Play}; pub use player_abilities::PlayerAbilities; pub use registry_data::RegistryData; pub use set_default_spawn_position::SetDefaultSpawnPosition; +pub use spawn_entity::{EntityType, SpawnEntity}; pub use status_response::StatusResponse; pub use synchronize_player_position::SynchronizePlayerPosition; +pub use teleport_entity::TeleportEntity; +pub use update_entity_position::UpdateEntityPosition; diff --git a/src/packets/client/spawn_entity.rs b/src/packets/client/spawn_entity.rs new file mode 100644 index 0000000..4300409 --- /dev/null +++ b/src/packets/client/spawn_entity.rs @@ -0,0 +1,27 @@ +use crate::packets::packet_ids::current_version; +use crate::types::{MCAngle, MCShort}; +use crate::types::{MCDouble, MCUuid, MCVarInt}; +use crate::{MCPacket, MCType}; + +pub enum EntityType { + Wolf = 118, + Zombie = 120, +} + +#[derive(MCPacket, Clone, Debug)] +#[packet(packet_id = current_version::play::client::SPAWN_ENTITY)] +pub struct SpawnEntity { + pub entity_id: MCVarInt, + pub entity_uuid: MCUuid, + pub entity_type: MCVarInt, + pub x: MCDouble, + pub y: MCDouble, + pub z: MCDouble, + pub pitch: MCAngle, + pub yaw: MCAngle, + pub head_yaw: MCAngle, + pub data: MCVarInt, + pub velocity_x: MCShort, + pub velocity_y: MCShort, + pub velocity_z: MCShort, +} diff --git a/src/packets/client/teleport_entity.rs b/src/packets/client/teleport_entity.rs new file mode 100644 index 0000000..9ee9df8 --- /dev/null +++ b/src/packets/client/teleport_entity.rs @@ -0,0 +1,15 @@ +use crate::packets::packet_ids::current_version; +use crate::types::{MCAngle, MCBoolean, MCDouble, MCVarInt}; +use crate::{MCPacket, MCType}; + +#[derive(MCPacket, Debug, Clone)] +#[packet(packet_id = current_version::play::client::TELEPORT_ENTITY)] +pub struct TeleportEntity { + pub entity_id: MCVarInt, + pub x: MCDouble, + pub y: MCDouble, + pub z: MCDouble, + pub yaw: MCAngle, + pub pitch: MCAngle, + pub on_ground: MCBoolean, +} diff --git a/src/packets/client/update_entity_position.rs b/src/packets/client/update_entity_position.rs new file mode 100644 index 0000000..4fa6f08 --- /dev/null +++ b/src/packets/client/update_entity_position.rs @@ -0,0 +1,13 @@ +use crate::packets::packet_ids::current_version; +use crate::types::{MCBoolean, MCShort, MCVarInt}; +use crate::{MCPacket, MCType}; + +#[derive(MCPacket, Debug, Clone)] +#[packet(packet_id = current_version::play::client::UPDATE_ENTITY_POSITION)] +pub struct UpdateEntityPosition { + pub entity_id: MCVarInt, + pub delta_x: MCShort, + pub delta_y: MCShort, + pub delta_z: MCShort, + pub on_ground: MCBoolean, +} diff --git a/src/packets/packet_ids.rs b/src/packets/packet_ids.rs index 97dd4a1..69a1ba9 100644 --- a/src/packets/packet_ids.rs +++ b/src/packets/packet_ids.rs @@ -33,12 +33,15 @@ mod version_1_20_4 { } pub mod play { pub mod client { + pub const SPAWN_ENTITY: i32 = 0x01; pub const KEEP_ALIVE: i32 = 0x24; pub const CHUNK_DATA_AND_UPDATE_LIGHT: i32 = 0x25; pub const PLAY: i32 = 0x29; pub const PLAYER_ABILITIES: i32 = 0x36; pub const SET_DEFAULT_SPAWN_POSITION: i32 = 0x54; pub const SYNCHRONIZE_PLAYER_POSITION: i32 = 0x3E; + pub const UPDATE_ENTITY_POSITION: i32 = 0x2C; + pub const TELEPORT_ENTITY: i32 = 0x6D; } pub mod server { pub const KEEP_ALIVE: i32 = 0x15;