aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/mining.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2023-07-15 04:39:43 -0500
committerGitHub <noreply@github.com>2023-07-15 04:39:43 -0500
commitcde7e35046b726b07bf3e067c080b85a12b2fd74 (patch)
tree9d517911cbaf14f007958a92392101f24ec14118 /azalea/src/mining.rs
parent148f20381750be3e2c38a6bdaf8d339113da1b39 (diff)
downloadazalea-drasl-cde7e35046b726b07bf3e067c080b85a12b2fd74.tar.xz
Attacking (#96)
* add Client::attack * partially implement attack cooldowns * attack speed modifiers * don't care clippy --------- Co-authored-by: mat <git@matdoes.dev>
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;
- }
- }
- }
-}