aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/movement.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/movement.rs
parentca2e0b3922da74799be812e5a534a20d611fce1a (diff)
downloadazalea-drasl-75efbc83fdc4a47f880e95259a339d41839af01a.tar.xz
make SendPacketEvent a bevy trigger
Diffstat (limited to 'azalea-client/src/plugins/movement.rs')
-rw-r--r--azalea-client/src/plugins/movement.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/azalea-client/src/plugins/movement.rs b/azalea-client/src/plugins/movement.rs
index 17b92e65..54a46bcb 100644
--- a/azalea-client/src/plugins/movement.rs
+++ b/azalea-client/src/plugins/movement.rs
@@ -17,7 +17,7 @@ use azalea_protocol::packets::{
};
use azalea_world::{MinecraftEntityId, MoveEntityError};
use bevy_app::{App, Plugin, Update};
-use bevy_ecs::prelude::{Event, EventWriter};
+use bevy_ecs::prelude::Event;
use bevy_ecs::schedule::SystemSet;
use bevy_ecs::system::Commands;
use bevy_ecs::{
@@ -158,7 +158,7 @@ pub fn send_position(
),
With<InLoadedChunk>,
>,
- mut send_packet_events: EventWriter<SendPacketEvent>,
+ mut commands: Commands,
) {
for (
entity,
@@ -245,7 +245,7 @@ pub fn send_position(
};
if let Some(packet) = packet {
- send_packet_events.send(SendPacketEvent {
+ commands.trigger(SendPacketEvent {
sent_by: entity,
packet,
});
@@ -257,7 +257,6 @@ pub fn send_position(
pub struct LastSentInput(pub ServerboundPlayerInput);
pub fn send_player_input_packet(
mut query: Query<(Entity, &PhysicsState, &Jumping, Option<&LastSentInput>)>,
- mut send_packet_events: EventWriter<SendPacketEvent>,
mut commands: Commands,
) {
for (entity, physics_state, jumping, last_sent_input) in query.iter_mut() {
@@ -279,7 +278,7 @@ pub fn send_player_input_packet(
let last_sent_input = last_sent_input.cloned().unwrap_or_default();
if input != last_sent_input.0 {
- send_packet_events.send(SendPacketEvent {
+ commands.trigger(SendPacketEvent {
sent_by: entity,
packet: input.clone().into_variant(),
});
@@ -290,7 +289,7 @@ pub fn send_player_input_packet(
fn send_sprinting_if_needed(
mut query: Query<(Entity, &MinecraftEntityId, &Sprinting, &mut PhysicsState)>,
- mut send_packet_events: EventWriter<SendPacketEvent>,
+ mut commands: Commands,
) {
for (entity, minecraft_entity_id, sprinting, mut physics_state) in query.iter_mut() {
let was_sprinting = physics_state.was_sprinting;
@@ -300,7 +299,7 @@ fn send_sprinting_if_needed(
} else {
azalea_protocol::packets::game::s_player_command::Action::StopSprinting
};
- send_packet_events.send(SendPacketEvent::new(
+ commands.trigger(SendPacketEvent::new(
entity,
ServerboundPlayerCommand {
id: *minecraft_entity_id,