diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-07-15 04:39:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-15 04:39:43 -0500 |
| commit | cde7e35046b726b07bf3e067c080b85a12b2fd74 (patch) | |
| tree | 9d517911cbaf14f007958a92392101f24ec14118 /azalea/src/container.rs | |
| parent | 148f20381750be3e2c38a6bdaf8d339113da1b39 (diff) | |
| download | azalea-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/container.rs')
| -rw-r--r-- | azalea/src/container.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/azalea/src/container.rs b/azalea/src/container.rs index dc0ba169..2261469d 100644 --- a/azalea/src/container.rs +++ b/azalea/src/container.rs @@ -3,7 +3,7 @@ use std::fmt::Formatter; use azalea_client::{ inventory::{CloseContainerEvent, ContainerClickEvent, InventoryComponent}, packet_handling::PacketEvent, - Client, TickBroadcast, + Client, }; use azalea_core::BlockPos; use azalea_inventory::{operations::ClickOperation, ItemSlot, Menu}; @@ -12,6 +12,8 @@ use bevy_app::{App, Plugin, Update}; use bevy_ecs::{component::Component, prelude::EventReader, system::Commands}; use std::fmt::Debug; +use crate::bot::BotClientExt; + pub struct ContainerPlugin; impl Plugin for ContainerPlugin { fn build(&self, app: &mut App) { @@ -49,11 +51,7 @@ impl ContainerClientExt for Client { .insert(WaitingForInventoryOpen); self.block_interact(pos); - let mut receiver = { - let ecs = self.ecs.lock(); - let tick_broadcast = ecs.resource::<TickBroadcast>(); - tick_broadcast.subscribe() - }; + let mut receiver = self.get_tick_broadcaster(); while receiver.recv().await.is_ok() { let ecs = self.ecs.lock(); if ecs.get::<WaitingForInventoryOpen>(self.entity).is_none() { |
