aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-04-05 01:46:14 +0330
committermat <git@matdoes.dev>2025-04-05 01:46:14 +0330
commitefc28db6cfa3cf45561610dcba9b2819553aa025 (patch)
tree2a58147b500b760cf024b6a62cd907321c476047
parentf250978cdd789d8ceb10cb225970a408933f508b (diff)
downloadazalea-drasl-efc28db6cfa3cf45561610dcba9b2819553aa025.tar.xz
remove unnecessary ecs system ordering for handle_outgoing_packets
-rw-r--r--azalea-client/src/plugins/brand.rs11
-rw-r--r--azalea-client/src/plugins/chat/mod.rs7
-rw-r--r--azalea-client/src/plugins/chunks.rs2
-rw-r--r--azalea-client/src/plugins/interact.rs2
-rw-r--r--azalea-client/src/plugins/inventory.rs3
-rw-r--r--azalea-client/src/plugins/respawn.rs3
-rw-r--r--azalea/src/accept_resource_packs.rs8
7 files changed, 10 insertions, 26 deletions
diff --git a/azalea-client/src/plugins/brand.rs b/azalea-client/src/plugins/brand.rs
index 94783230..cf179e71 100644
--- a/azalea-client/src/plugins/brand.rs
+++ b/azalea-client/src/plugins/brand.rs
@@ -17,24 +17,21 @@ use crate::packet::login::InLoginState;
pub struct BrandPlugin;
impl Plugin for BrandPlugin {
fn build(&self, app: &mut App) {
- app.add_systems(
- Update,
- handle_end_login_state.before(crate::packet::config::handle_outgoing_packets),
- );
+ app.add_systems(Update, handle_end_login_state);
}
}
pub fn handle_end_login_state(
+ mut commands: Commands,
mut removed: RemovedComponents<InLoginState>,
query: Query<&ClientInformation>,
- mut send_packet_events: EventWriter<SendConfigPacketEvent>,
) {
for entity in removed.read() {
let mut brand_data = Vec::new();
// azalea pretends to be vanilla everywhere else so it makes sense to lie here
// too
"vanilla".azalea_write(&mut brand_data).unwrap();
- send_packet_events.send(SendConfigPacketEvent::new(
+ commands.trigger(SendConfigPacketEvent::new(
entity,
ServerboundCustomPayload {
identifier: ResourceLocation::new("brand"),
@@ -53,7 +50,7 @@ pub fn handle_end_login_state(
};
debug!("Writing ClientInformation while in config state: {client_information:?}");
- send_packet_events.send(SendConfigPacketEvent::new(
+ commands.trigger(SendConfigPacketEvent::new(
entity,
ServerboundClientInformation {
information: client_information.clone(),
diff --git a/azalea-client/src/plugins/chat/mod.rs b/azalea-client/src/plugins/chat/mod.rs
index 1e083c94..3d03d24e 100644
--- a/azalea-client/src/plugins/chat/mod.rs
+++ b/azalea-client/src/plugins/chat/mod.rs
@@ -19,7 +19,6 @@ use bevy_ecs::{
use handler::{SendChatKindEvent, handle_send_chat_kind_event};
use uuid::Uuid;
-use super::packet::game::handle_outgoing_packets;
use crate::client::Client;
pub struct ChatPlugin;
@@ -30,11 +29,7 @@ impl Plugin for ChatPlugin {
.add_event::<ChatReceivedEvent>()
.add_systems(
Update,
- (
- handle_send_chat_event,
- handle_send_chat_kind_event.after(handle_outgoing_packets),
- )
- .chain(),
+ (handle_send_chat_event, handle_send_chat_kind_event).chain(),
);
}
}
diff --git a/azalea-client/src/plugins/chunks.rs b/azalea-client/src/plugins/chunks.rs
index 060b94e2..5599d7c9 100644
--- a/azalea-client/src/plugins/chunks.rs
+++ b/azalea-client/src/plugins/chunks.rs
@@ -16,7 +16,6 @@ use bevy_app::{App, Plugin, Update};
use bevy_ecs::prelude::*;
use tracing::{error, trace};
-use super::packet::game::handle_outgoing_packets;
use crate::{
InstanceHolder, interact::handle_block_interact_event, inventory::InventorySet,
packet::game::SendPacketEvent, respawn::perform_respawn,
@@ -33,7 +32,6 @@ impl Plugin for ChunksPlugin {
handle_chunk_batch_finished_event,
)
.chain()
- .before(handle_outgoing_packets)
.before(InventorySet)
.before(handle_block_interact_event)
.before(perform_respawn),
diff --git a/azalea-client/src/plugins/interact.rs b/azalea-client/src/plugins/interact.rs
index f7239c17..9e638a06 100644
--- a/azalea-client/src/plugins/interact.rs
+++ b/azalea-client/src/plugins/interact.rs
@@ -31,7 +31,6 @@ use bevy_ecs::{
use derive_more::{Deref, DerefMut};
use tracing::warn;
-use super::packet::game::handle_outgoing_packets;
use crate::{
Client,
attack::handle_attack_event,
@@ -56,7 +55,6 @@ impl Plugin for InteractPlugin {
handle_block_interact_event,
handle_swing_arm_event,
)
- .before(handle_outgoing_packets)
.after(InventorySet)
.after(perform_respawn)
.after(handle_attack_event)
diff --git a/azalea-client/src/plugins/inventory.rs b/azalea-client/src/plugins/inventory.rs
index 844dd248..e6394ab8 100644
--- a/azalea-client/src/plugins/inventory.rs
+++ b/azalea-client/src/plugins/inventory.rs
@@ -26,7 +26,6 @@ use bevy_ecs::{
};
use tracing::{error, warn};
-use super::packet::game::handle_outgoing_packets;
use crate::{
Client, local_player::PlayerAbilities, packet::game::SendPacketEvent, respawn::perform_respawn,
};
@@ -47,7 +46,7 @@ impl Plugin for InventoryPlugin {
handle_menu_opened_event,
handle_set_container_content_event,
handle_container_click_event,
- handle_container_close_event.before(handle_outgoing_packets),
+ handle_container_close_event,
handle_client_side_close_container_event,
)
.chain()
diff --git a/azalea-client/src/plugins/respawn.rs b/azalea-client/src/plugins/respawn.rs
index 24479805..f0ddd2b8 100644
--- a/azalea-client/src/plugins/respawn.rs
+++ b/azalea-client/src/plugins/respawn.rs
@@ -2,7 +2,6 @@ use azalea_protocol::packets::game::s_client_command::{self, ServerboundClientCo
use bevy_app::{App, Plugin, Update};
use bevy_ecs::prelude::*;
-use super::packet::game::handle_outgoing_packets;
use crate::packet::game::SendPacketEvent;
/// Tell the server that we're respawning.
@@ -16,7 +15,7 @@ pub struct RespawnPlugin;
impl Plugin for RespawnPlugin {
fn build(&self, app: &mut App) {
app.add_event::<PerformRespawnEvent>()
- .add_systems(Update, perform_respawn.before(handle_outgoing_packets));
+ .add_systems(Update, perform_respawn);
}
}
diff --git a/azalea/src/accept_resource_packs.rs b/azalea/src/accept_resource_packs.rs
index 25caf93d..c310d541 100644
--- a/azalea/src/accept_resource_packs.rs
+++ b/azalea/src/accept_resource_packs.rs
@@ -1,7 +1,7 @@
use azalea_client::InConfigState;
use azalea_client::chunks::handle_chunk_batch_finished_event;
use azalea_client::inventory::InventorySet;
-use azalea_client::packet::config::{SendConfigPacketEvent, handle_outgoing_packets};
+use azalea_client::packet::config::SendConfigPacketEvent;
use azalea_client::packet::game::SendPacketEvent;
use azalea_client::packet::{death_event_on_0_health, game::ResourcePackEvent};
use azalea_client::respawn::perform_respawn;
@@ -24,7 +24,6 @@ impl Plugin for AcceptResourcePacksPlugin {
.after(death_event_on_0_health)
.after(handle_chunk_batch_finished_event)
.after(InventorySet)
- .before(handle_outgoing_packets)
.after(azalea_client::brand::handle_end_login_state),
);
}
@@ -33,7 +32,6 @@ impl Plugin for AcceptResourcePacksPlugin {
fn accept_resource_pack(
mut events: EventReader<ResourcePackEvent>,
mut commands: Commands,
- mut send_config_packet_events: EventWriter<SendConfigPacketEvent>,
query_in_config_state: Query<Option<&InConfigState>>,
) {
for event in events.read() {
@@ -42,14 +40,14 @@ fn accept_resource_pack(
};
if in_config_state_option.is_some() {
- send_config_packet_events.send(SendConfigPacketEvent::new(
+ commands.trigger(SendConfigPacketEvent::new(
event.entity,
config::ServerboundResourcePack {
id: event.id,
action: config::s_resource_pack::Action::Accepted,
},
));
- send_config_packet_events.send(SendConfigPacketEvent::new(
+ commands.trigger(SendConfigPacketEvent::new(
event.entity,
config::ServerboundResourcePack {
id: event.id,