diff options
| author | mat <git@matdoes.dev> | 2025-03-19 21:35:47 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-03-19 21:35:47 +0000 |
| commit | 75efbc83fdc4a47f880e95259a339d41839af01a (patch) | |
| tree | ee5ddeb328fc126ef04adb8006f13513acb48d60 /azalea-client/src/test_simulation.rs | |
| parent | ca2e0b3922da74799be812e5a534a20d611fce1a (diff) | |
| download | azalea-drasl-75efbc83fdc4a47f880e95259a339d41839af01a.tar.xz | |
make SendPacketEvent a bevy trigger
Diffstat (limited to 'azalea-client/src/test_simulation.rs')
| -rw-r--r-- | azalea-client/src/test_simulation.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/azalea-client/src/test_simulation.rs b/azalea-client/src/test_simulation.rs index 564db0cf..0f34c14e 100644 --- a/azalea-client/src/test_simulation.rs +++ b/azalea-client/src/test_simulation.rs @@ -113,6 +113,15 @@ impl Simulation { pub fn has_component<T: Component>(&self) -> bool { self.app.world().get::<T>(self.entity).is_some() } + pub fn resource<T: Resource + Clone>(&self) -> T { + self.app.world().get_resource::<T>().unwrap().clone() + } + pub fn with_resource<T: Resource>(&self, f: impl FnOnce(&T)) { + f(self.app.world().get_resource::<T>().unwrap()); + } + pub fn with_resource_mut<T: Resource>(&mut self, f: impl FnOnce(Mut<T>)) { + f(self.app.world_mut().get_resource_mut::<T>().unwrap()); + } pub fn chunk(&self, chunk_pos: ChunkPos) -> Option<Arc<RwLock<Chunk>>> { self.component::<InstanceHolder>() |
