aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src/world.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-12-11 02:24:31 -0600
committermat <github@matdoes.dev>2022-12-11 02:24:31 -0600
commitb60a55e61ed5ee7a37df20802b6d95543657ea40 (patch)
tree0de5fbd490eddb41f04ead69d1042de8e2c027ea /azalea-world/src/world.rs
parent37b9f10b3bcc74b48df2c6843a5286a7d41e2414 (diff)
downloadazalea-drasl-b60a55e61ed5ee7a37df20802b6d95543657ea40.tar.xz
rename find_entity to entity_by & add entities_by
Diffstat (limited to 'azalea-world/src/world.rs')
-rw-r--r--azalea-world/src/world.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs
index 648613b9..ad6037a5 100644
--- a/azalea-world/src/world.rs
+++ b/azalea-world/src/world.rs
@@ -164,11 +164,18 @@ impl WeakWorld {
self.entity_storage.read().get_by_uuid(uuid)
}
- pub fn find_entity<F>(&self, mut f: F) -> Option<Arc<EntityData>>
+ pub fn entity_by<F>(&self, mut f: F) -> Option<Arc<EntityData>>
where
F: FnMut(&EntityData) -> bool,
{
- self.entity_storage.read().find_entity(|entity| f(entity))
+ self.entity_storage.read().entity_by(|e| f(e))
+ }
+
+ pub fn entities_by<F>(&self, mut f: F) -> Vec<Arc<EntityData>>
+ where
+ F: FnMut(&EntityData) -> bool,
+ {
+ self.entity_storage.read().entities_by(|e| f(e))
}
pub fn set_entity_pos(&self, entity_id: u32, new_pos: Vec3) -> Result<(), MoveEntityError> {