diff options
| author | mat <github@matdoes.dev> | 2022-12-11 02:24:31 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-12-11 02:24:31 -0600 |
| commit | b60a55e61ed5ee7a37df20802b6d95543657ea40 (patch) | |
| tree | 0de5fbd490eddb41f04ead69d1042de8e2c027ea /azalea-world/src/world.rs | |
| parent | 37b9f10b3bcc74b48df2c6843a5286a7d41e2414 (diff) | |
| download | azalea-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.rs | 11 |
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> { |
