From 5ca49e680ed8519456dc9a9af84321d4b69dcbb3 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 23 Jun 2022 15:12:17 -0500 Subject: azalea-buf --- azalea-entity/src/lib.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'azalea-entity/src/lib.rs') diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index d32a1a96..2283142f 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -1,6 +1,11 @@ +mod data; + use azalea_core::EntityPos; #[cfg(feature = "protocol")] -use azalea_protocol::packets::game::clientbound_add_entity_packet::ClientboundAddEntityPacket; +use azalea_protocol::packets::game::{ + clientbound_add_entity_packet::ClientboundAddEntityPacket, + clientbound_add_player_packet::ClientboundAddPlayerPacket, +}; use uuid::Uuid; #[derive(Default, Debug)] @@ -38,6 +43,21 @@ impl From<&ClientboundAddEntityPacket> for Entity { } } +#[cfg(feature = "protocol")] +impl From<&ClientboundAddPlayerPacket> for Entity { + fn from(p: &ClientboundAddPlayerPacket) -> Self { + Self { + id: p.id, + uuid: p.uuid, + pos: EntityPos { + x: p.x, + y: p.y, + z: p.z, + }, + } + } +} + // #[cfg(test)] // mod tests { // #[test] -- cgit v1.2.3