aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/mining.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea/src/mining.rs')
-rw-r--r--azalea/src/mining.rs40
1 files changed, 0 insertions, 40 deletions
diff --git a/azalea/src/mining.rs b/azalea/src/mining.rs
deleted file mode 100644
index 8ba16436..00000000
--- a/azalea/src/mining.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-use azalea_client::{
- interact::SwingArmEvent,
- mining::{Mining, StartMiningBlockEvent},
- Client, TickBroadcast,
-};
-use azalea_core::BlockPos;
-
-pub trait MiningExt {
- /// Start mining a block.
- async fn mine(&mut self, position: BlockPos);
-}
-
-impl MiningExt for Client {
- /// Start mining a block. This won't turn the bot's head towards the block,
- /// so you'll have to do that yourself with [`look_at`].
- ///
- /// [`look_at`]: crate::prelude::BotClientExt::look_at
- async fn mine(&mut self, position: BlockPos) {
- self.ecs.lock().send_event(StartMiningBlockEvent {
- entity: self.entity,
- position,
- });
- // vanilla sends an extra swing arm packet when we start mining
- self.ecs.lock().send_event(SwingArmEvent {
- entity: self.entity,
- });
-
- let mut receiver = {
- let ecs = self.ecs.lock();
- let tick_broadcast = ecs.resource::<TickBroadcast>();
- tick_broadcast.subscribe()
- };
- while receiver.recv().await.is_ok() {
- let ecs = self.ecs.lock();
- if ecs.get::<Mining>(self.entity).is_none() {
- break;
- }
- }
- }
-}