From f2a8e8221d9de6e76721d3c947ba9f1ab7c3c90d Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 30 Apr 2022 22:13:47 -0500 Subject: add clientbound_add_entity_packet --- .../packets/game/clientbound_add_entity_packet.rs | 26 ++++++++++++++++++++++ azalea-protocol/src/packets/game/mod.rs | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs (limited to 'azalea-protocol/src/packets') diff --git a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs new file mode 100644 index 00000000..ad948922 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs @@ -0,0 +1,26 @@ +use crate::mc_buf::UnsizedByteArray; +use azalea_core::resource_location::ResourceLocation; +use packet_macros::GamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, GamePacket)] +pub struct ClientboundAddEntityPacket { + #[varint] + pub id: i32, + pub uuid: Uuid, + // TODO: have an entity type struct + #[varint] + pub entity_type: i32, + pub x: f64, + pub y: f64, + pub z: f64, + pub x_rot: i8, + pub y_rot: i8, + pub data: i8, + /// X acceleration + pub xa: u16, + /// Y acceleration + pub ya: u16, + /// Z acceleration + pub za: u16, +} diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index d957627e..9cde366c 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -1,3 +1,4 @@ +pub mod clientbound_add_entity_packet; pub mod clientbound_change_difficulty_packet; pub mod clientbound_custom_payload_packet; pub mod clientbound_declare_commands_packet; @@ -22,6 +23,7 @@ declare_state_packets!( GamePacket, Serverbound => {}, Clientbound => { + 0x02: clientbound_add_entity_packet::ClientboundAddEntityPacket, 0x0e: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket, 0x12: clientbound_declare_commands_packet::ClientboundDeclareCommandsPacket, 0x1a: clientbound_disconnect_packet::ClientboundDisconnectPacket, -- cgit v1.2.3