diff options
| author | mat <git@matdoes.dev> | 2025-06-11 22:22:26 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-11 22:22:26 +0000 |
| commit | 1b348ceeffc61e49b19f2982e7a9de479c1678de (patch) | |
| tree | bead28ce1a076a3af5ca5df2c326c9e94b63dd92 /azalea-client/src/test_utils | |
| parent | 067ec06f26ecaf7a319eb3ce61307b9730176313 (diff) | |
| download | azalea-drasl-1b348ceeffc61e49b19f2982e7a9de479c1678de.tar.xz | |
implement reverting block state predictions on ack
Diffstat (limited to 'azalea-client/src/test_utils')
| -rw-r--r-- | azalea-client/src/test_utils/simulation.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/azalea-client/src/test_utils/simulation.rs b/azalea-client/src/test_utils/simulation.rs index caf63113..e7ac8d5b 100644 --- a/azalea-client/src/test_utils/simulation.rs +++ b/azalea-client/src/test_utils/simulation.rs @@ -6,7 +6,7 @@ use azalea_buf::AzaleaWrite; use azalea_core::{ delta::PositionDelta8, game_type::{GameMode, OptionalGameType}, - position::{ChunkPos, Vec3}, + position::{BlockPos, ChunkPos, Vec3}, resource_location::ResourceLocation, tick::GameTick, }; @@ -102,6 +102,9 @@ impl Simulation { raw_conn.injected_clientbound_packets.push(buf); }); } + pub fn send_event(&mut self, event: impl bevy_ecs::event::Event) { + self.app.world_mut().send_event(event); + } pub fn tick(&mut self) { tick_app(&mut self.app); @@ -151,6 +154,12 @@ impl Simulation { .chunks .get(&chunk_pos) } + pub fn get_block_state(&self, pos: BlockPos) -> Option<BlockState> { + self.component::<InstanceHolder>() + .instance + .read() + .get_block_state(pos) + } pub fn disconnect(&mut self) { // send DisconnectEvent |
