diff options
Diffstat (limited to 'azalea-entity/src')
| -rw-r--r-- | azalea-entity/src/lib.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index 0e0178b5..f9d808c2 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -1,9 +1,13 @@ use azalea_core::EntityPos; +#[cfg(feature = "protocol")] +use azalea_protocol::packets::game::clientbound_add_entity_packet::ClientboundAddEntityPacket; +use uuid::Uuid; #[derive(Default, Debug)] pub struct Entity { /// The incrementing numerical id of the entity. pub id: u32, + pub uuid: Uuid, pos: EntityPos, } @@ -18,6 +22,25 @@ impl Entity { } } +#[cfg(feature = "protocol")] +impl From<&azalea_protocol::packets::game::clientbound_add_entity_packet::ClientboundAddEntityPacket> + for Entity +{ + fn from( + p: &azalea_protocol::packets::game::clientbound_add_entity_packet::ClientboundAddEntityPacket, + ) -> Self { + Self { + id: p.id, + uuid: p.uuid, + pos: EntityPos { + x: p.x, + y: p.y, + z: p.z, + }, + } + } +} + // #[cfg(test)] // mod tests { // #[test] |
