diff options
| author | mat <github@matdoes.dev> | 2022-06-19 00:30:24 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-19 00:30:24 -0500 |
| commit | bb6b116cb81a64deeb5ee8c1d021f27dba1cbc58 (patch) | |
| tree | 8d41411757cf46c8ca0277a1466385d290f984b4 /azalea-entity | |
| parent | fc3151f89db1cf018bfebebb8f102e20911e64d3 (diff) | |
| download | azalea-drasl-bb6b116cb81a64deeb5ee8c1d021f27dba1cbc58.tar.xz | |
Improvements to azalea-world for entities
Diffstat (limited to 'azalea-entity')
| -rw-r--r-- | azalea-entity/src/lib.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index f9d808c2..f776f16f 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -1,4 +1,4 @@ -use azalea_core::EntityPos; +use azalea_core::{ChunkPos, EntityPos}; #[cfg(feature = "protocol")] use azalea_protocol::packets::game::clientbound_add_entity_packet::ClientboundAddEntityPacket; use uuid::Uuid; @@ -16,19 +16,16 @@ impl Entity { &self.pos } - pub fn set_pos(&mut self, pos: EntityPos) { - // TODO: check if it moved to another chunk - self.pos = pos; + /// Sets the position of the entity. This doesn't update the cache in + /// azalea-world, and should only be used within azalea-world! + pub fn unsafe_move(&mut self, new_pos: EntityPos) { + self.pos = new_pos; } } #[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 { +impl From<&ClientboundAddEntityPacket> for Entity { + fn from(p: &ClientboundAddEntityPacket) -> Self { Self { id: p.id, uuid: p.uuid, |
