aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src/plugin/indexing.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-04-04 06:11:15 -1400
committermat <git@matdoes.dev>2025-04-04 18:24:22 -0200
commite99ae608b67ad3ff105666e619d04ca9385488e1 (patch)
tree2457aa38334ccc4a542d0fbf52ca09db39c31c0b /azalea-entity/src/plugin/indexing.rs
parent1fd02925903cfe59e85977b5c27e49457d99b142 (diff)
downloadazalea-drasl-e99ae608b67ad3ff105666e619d04ca9385488e1.tar.xz
rename ChatPacket::username and uuid to sender and sender_uuid
also adds more convenience functions to Client
Diffstat (limited to 'azalea-entity/src/plugin/indexing.rs')
-rw-r--r--azalea-entity/src/plugin/indexing.rs9
1 files changed, 6 insertions, 3 deletions
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<Entity> {
+ pub fn get_by_minecraft_entity(&self, id: MinecraftEntityId) -> Option<Entity> {
self.entity_by_id.get(&id).copied()
}
+ pub fn get_by_ecs_entity(&self, entity: Entity) -> Option<MinecraftEntityId> {
+ 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<Entity> {
+ pub fn remove_by_minecraft_entity(&mut self, id: MinecraftEntityId) -> Option<Entity> {
if let Some(entity) = self.entity_by_id.remove(&id) {
trace!(
"Removed {id} -> {entity:?} from a client's EntityIdIndex (using EntityIdIndex::remove)"