1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

remove unnecessary ecs system ordering for handle_outgoing_packets

This commit is contained in:
mat 2025-04-05 01:46:14 +03:30
parent f250978cdd
commit efc28db6cf
7 changed files with 10 additions and 26 deletions

View file

@ -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(),

View file

@ -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(),
);
}
}

View file

@ -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),

View file

@ -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)

View file

@ -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()

View file

@ -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);
}
}

View file

@ -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,