From e99ae608b67ad3ff105666e619d04ca9385488e1 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 4 Apr 2025 06:11:15 -1400 Subject: rename ChatPacket::username and uuid to sender and sender_uuid also adds more convenience functions to Client --- azalea-entity/src/plugin/indexing.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'azalea-entity/src/plugin') diff --git a/azalea-entity/src/plugin/indexing.rs b/azalea-entity/src/plugin/indexing.rs index 85f0f76c..2a7643b0 100644 --- a/azalea-entity/src/plugin/indexing.rs +++ b/azalea-entity/src/plugin/indexing.rs @@ -64,11 +64,14 @@ pub struct EntityIdIndex { } impl EntityIdIndex { - pub fn get(&self, id: MinecraftEntityId) -> Option { + pub fn get_by_minecraft_entity(&self, id: MinecraftEntityId) -> Option { self.entity_by_id.get(&id).copied() } + pub fn get_by_ecs_entity(&self, entity: Entity) -> Option { + self.id_by_entity.get(&entity).copied() + } - pub fn contains_key(&self, id: MinecraftEntityId) -> bool { + pub fn contains_minecraft_entity(&self, id: MinecraftEntityId) -> bool { self.entity_by_id.contains_key(&id) } pub fn contains_ecs_entity(&self, id: Entity) -> bool { @@ -81,7 +84,7 @@ impl EntityIdIndex { trace!("Inserted {id} -> {entity:?} into a client's EntityIdIndex"); } - pub fn remove(&mut self, id: MinecraftEntityId) -> Option { + pub fn remove_by_minecraft_entity(&mut self, id: MinecraftEntityId) -> Option { if let Some(entity) = self.entity_by_id.remove(&id) { trace!( "Removed {id} -> {entity:?} from a client's EntityIdIndex (using EntityIdIndex::remove)" -- cgit v1.2.3