diff options
| author | mat <github@matdoes.dev> | 2022-06-23 19:17:04 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-23 19:17:04 -0500 |
| commit | 37c6618c16319a7f40fd2e165190407472598e84 (patch) | |
| tree | 6d712df8893041f0e49cfa6ca7adc9a411d39b84 /azalea-entity/src/lib.rs | |
| parent | 1089aa7961bd9af67c94dec9c5dbc6bd9f275225 (diff) | |
| download | azalea-drasl-37c6618c16319a7f40fd2e165190407472598e84.tar.xz | |
Fix everything so azalea-buf works
Diffstat (limited to 'azalea-entity/src/lib.rs')
| -rw-r--r-- | azalea-entity/src/lib.rs | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index 2283142f..93ed5ea8 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -6,6 +6,7 @@ use azalea_protocol::packets::game::{ clientbound_add_entity_packet::ClientboundAddEntityPacket, clientbound_add_player_packet::ClientboundAddPlayerPacket, }; +pub use data::*; use uuid::Uuid; #[derive(Default, Debug)] @@ -13,10 +14,14 @@ pub struct Entity { /// The incrementing numerical id of the entity. pub id: u32, pub uuid: Uuid, - pos: EntityPos, + pub pos: EntityPos, } impl Entity { + pub fn new(id: u32, uuid: Uuid, pos: EntityPos) -> Self { + Self { id, uuid, pos } + } + pub fn pos(&self) -> &EntityPos { &self.pos } @@ -28,36 +33,6 @@ impl Entity { } } -#[cfg(feature = "protocol")] -impl From<&ClientboundAddEntityPacket> for Entity { - fn from(p: &ClientboundAddEntityPacket) -> Self { - Self { - id: p.id, - uuid: p.uuid, - pos: EntityPos { - x: p.x, - y: p.y, - z: p.z, - }, - } - } -} - -#[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] |
