aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src/lib.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-06-20 01:19:59 -0500
committermat <github@matdoes.dev>2022-06-20 01:19:59 -0500
commitefd874957331d8bff1cefa0f43d81685690391bf (patch)
tree8c3ba4dd23f0bb15f467a49597068a62fd91ff6c /azalea-world/src/lib.rs
parent438d633b83dde37e3d3564706da466963a8bc999 (diff)
downloadazalea-drasl-efd874957331d8bff1cefa0f43d81685690391bf.tar.xz
add gametick event and find_one_entity
Diffstat (limited to 'azalea-world/src/lib.rs')
-rw-r--r--azalea-world/src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/azalea-world/src/lib.rs b/azalea-world/src/lib.rs
index dc538618..10beb309 100644
--- a/azalea-world/src/lib.rs
+++ b/azalea-world/src/lib.rs
@@ -87,6 +87,19 @@ impl World {
pub fn entity_by_id(&self, id: u32) -> Option<&Entity> {
self.entity_storage.get_by_id(id)
}
+
+ /// Get an iterator over all entities.
+ #[inline]
+ pub fn entities(&self) -> std::collections::hash_map::Values<'_, u32, Entity> {
+ self.entity_storage.entities()
+ }
+
+ pub fn find_one_entity<F>(&self, mut f: F) -> Option<&Entity>
+ where
+ F: FnMut(&Entity) -> bool,
+ {
+ self.entity_storage.find_one_entity(|entity| f(entity))
+ }
}
impl Index<&ChunkPos> for World {