diff options
| author | mat <github@matdoes.dev> | 2022-06-18 14:08:34 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-18 14:08:34 -0500 |
| commit | d8e0457b62f5826183671e5b05890b400be35709 (patch) | |
| tree | d40dccc61a2e96d60e2f678bca075102b28232c8 /azalea-entity/src | |
| parent | 614b21129804930159f041ce3f51202bc3e1c0b6 (diff) | |
| download | azalea-drasl-d8e0457b62f5826183671e5b05890b400be35709.tar.xz | |
from<ClientboundAddEntityPacket> for Entity
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] |
