From 1b348ceeffc61e49b19f2982e7a9de479c1678de Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 11 Jun 2025 22:22:26 +0000 Subject: implement reverting block state predictions on ack --- azalea-client/src/test_utils/simulation.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'azalea-client/src/test_utils') 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 { + self.component::() + .instance + .read() + .get_block_state(pos) + } pub fn disconnect(&mut self) { // send DisconnectEvent -- cgit v1.2.3