aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/mining.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-03-19 21:35:47 +0000
committermat <git@matdoes.dev>2025-03-19 21:35:47 +0000
commit75efbc83fdc4a47f880e95259a339d41839af01a (patch)
treeee5ddeb328fc126ef04adb8006f13513acb48d60 /azalea-client/src/plugins/mining.rs
parentca2e0b3922da74799be812e5a534a20d611fce1a (diff)
downloadazalea-drasl-75efbc83fdc4a47f880e95259a339d41839af01a.tar.xz
make SendPacketEvent a bevy trigger
Diffstat (limited to 'azalea-client/src/plugins/mining.rs')
-rw-r--r--azalea-client/src/plugins/mining.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/azalea-client/src/plugins/mining.rs b/azalea-client/src/plugins/mining.rs
index beb380b7..d4a6f2a0 100644
--- a/azalea-client/src/plugins/mining.rs
+++ b/azalea-client/src/plugins/mining.rs
@@ -186,7 +186,7 @@ pub struct StartMiningBlockWithDirectionEvent {
fn handle_start_mining_block_with_direction_event(
mut events: EventReader<StartMiningBlockWithDirectionEvent>,
mut finish_mining_events: EventWriter<FinishMiningBlockEvent>,
- mut send_packet_events: EventWriter<SendPacketEvent>,
+ mut commands: Commands,
mut attack_block_events: EventWriter<AttackBlockEvent>,
mut mine_block_progress_events: EventWriter<MineBlockProgressEvent>,
mut query: Query<(
@@ -204,7 +204,6 @@ fn handle_start_mining_block_with_direction_event(
&mut MineBlockPos,
)>,
instances: Res<InstanceContainer>,
- mut commands: Commands,
) {
for event in events.read() {
let (
@@ -252,7 +251,7 @@ fn handle_start_mining_block_with_direction_event(
{
if mining.is_some() {
// send a packet to stop mining since we just changed target
- send_packet_events.send(SendPacketEvent::new(
+ commands.trigger(SendPacketEvent::new(
event.entity,
ServerboundPlayerAction {
action: s_player_action::Action::AbortDestroyBlock,
@@ -324,7 +323,7 @@ fn handle_start_mining_block_with_direction_event(
});
}
- send_packet_events.send(SendPacketEvent::new(
+ commands.trigger(SendPacketEvent::new(
event.entity,
ServerboundPlayerAction {
action: s_player_action::Action::StartDestroyBlock,
@@ -483,17 +482,16 @@ pub struct StopMiningBlockEvent {
}
pub fn handle_stop_mining_block_event(
mut events: EventReader<StopMiningBlockEvent>,
- mut send_packet_events: EventWriter<SendPacketEvent>,
+ mut commands: Commands,
mut mine_block_progress_events: EventWriter<MineBlockProgressEvent>,
mut query: Query<(&mut Mining, &MineBlockPos, &mut MineProgress)>,
- mut commands: Commands,
) {
for event in events.read() {
let (mut _mining, mine_block_pos, mut mine_progress) = query.get_mut(event.entity).unwrap();
let mine_block_pos =
mine_block_pos.expect("IsMining is true so MineBlockPos must be present");
- send_packet_events.send(SendPacketEvent::new(
+ commands.trigger(SendPacketEvent::new(
event.entity,
ServerboundPlayerAction {
action: s_player_action::Action::AbortDestroyBlock,
@@ -529,13 +527,12 @@ pub fn continue_mining_block(
&mut MineTicks,
&mut CurrentSequenceNumber,
)>,
- mut send_packet_events: EventWriter<SendPacketEvent>,
+ mut commands: Commands,
mut mine_block_progress_events: EventWriter<MineBlockProgressEvent>,
mut finish_mining_events: EventWriter<FinishMiningBlockEvent>,
mut start_mining_events: EventWriter<StartMiningBlockWithDirectionEvent>,
mut swing_arm_events: EventWriter<SwingArmEvent>,
instances: Res<InstanceContainer>,
- mut commands: Commands,
) {
for (
entity,
@@ -566,7 +563,7 @@ pub fn continue_mining_block(
position: mining.pos,
});
*sequence_number += 1;
- send_packet_events.send(SendPacketEvent::new(
+ commands.trigger(SendPacketEvent::new(
entity,
ServerboundPlayerAction {
action: s_player_action::Action::StartDestroyBlock,
@@ -611,7 +608,7 @@ pub fn continue_mining_block(
entity,
position: mining.pos,
});
- send_packet_events.send(SendPacketEvent::new(
+ commands.trigger(SendPacketEvent::new(
entity,
ServerboundPlayerAction {
action: s_player_action::Action::StopDestroyBlock,