From 9513f42e87f64c409cdb2a100500a50e5a713bac Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sat, 27 Dec 2025 22:02:00 -0600 Subject: Move Client struct to azalea crate (#297) * move the Client struct out of azalea-client into azalea * actually add client impls in azalea --- azalea/src/client_impl/mining.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 azalea/src/client_impl/mining.rs (limited to 'azalea/src/client_impl/mining.rs') diff --git a/azalea/src/client_impl/mining.rs b/azalea/src/client_impl/mining.rs new file mode 100644 index 00000000..14794765 --- /dev/null +++ b/azalea/src/client_impl/mining.rs @@ -0,0 +1,29 @@ +use azalea_client::mining::{LeftClickMine, StartMiningBlockEvent}; +use azalea_core::position::BlockPos; + +use crate::Client; + +impl Client { + pub fn start_mining(&self, position: BlockPos) { + let mut ecs = self.ecs.lock(); + + ecs.write_message(StartMiningBlockEvent { + entity: self.entity, + position, + force: true, + }); + } + + /// When enabled, the bot will mine any block that it is looking at if it is + /// reachable. + pub fn left_click_mine(&self, enabled: bool) { + let mut ecs = self.ecs.lock(); + let mut entity_mut = ecs.entity_mut(self.entity); + + if enabled { + entity_mut.insert(LeftClickMine); + } else { + entity_mut.remove::(); + } + } +} -- cgit v1.2.3