aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-04-17 10:15:14 -1245
committermat <git@matdoes.dev>2025-04-17 10:15:14 -1245
commitad45cf5431939d088b97aa8a368ed910332b53d2 (patch)
tree845a607d945e66e84f5677f7289f58d70334677f /azalea-client/src/plugins
parent43d7c428e317f503dda899cade9e3ec8024de4de (diff)
downloadazalea-drasl-ad45cf5431939d088b97aa8a368ed910332b53d2.tar.xz
allow disabling Event::Packet with a crate feature
Diffstat (limited to 'azalea-client/src/plugins')
-rw-r--r--azalea-client/src/plugins/events.rs14
-rw-r--r--azalea-client/src/plugins/packet/game/mod.rs2
2 files changed, 8 insertions, 8 deletions
diff --git a/azalea-client/src/plugins/events.rs b/azalea-client/src/plugins/events.rs
index 85f50ea5..e92242af 100644
--- a/azalea-client/src/plugins/events.rs
+++ b/azalea-client/src/plugins/events.rs
@@ -6,9 +6,7 @@ use std::sync::Arc;
use azalea_chat::FormattedText;
use azalea_core::tick::GameTick;
use azalea_entity::{Dead, InLoadedChunk};
-use azalea_protocol::packets::game::{
- ClientboundGamePacket, c_player_combat_kill::ClientboundPlayerCombatKill,
-};
+use azalea_protocol::packets::game::c_player_combat_kill::ClientboundPlayerCombatKill;
use azalea_world::{InstanceName, MinecraftEntityId};
use bevy_app::{App, Plugin, PreUpdate, Update};
use bevy_ecs::{
@@ -27,8 +25,7 @@ use crate::{
chat::{ChatPacket, ChatReceivedEvent},
disconnect::DisconnectEvent,
packet::game::{
- AddPlayerEvent, DeathEvent, KeepAliveEvent, ReceiveGamePacketEvent, RemovePlayerEvent,
- UpdatePlayerEvent,
+ AddPlayerEvent, DeathEvent, KeepAliveEvent, RemovePlayerEvent, UpdatePlayerEvent,
},
};
@@ -94,6 +91,7 @@ pub enum Event {
Chat(ChatPacket),
/// Happens 20 times per second, but only when the world is loaded.
Tick,
+ #[cfg(feature = "packet-event")]
/// We received a packet from the server.
///
/// ```
@@ -111,7 +109,7 @@ pub enum Event {
/// # }
/// # }
/// ```
- Packet(Arc<ClientboundGamePacket>),
+ Packet(Arc<azalea_protocol::packets::game::ClientboundGamePacket>),
/// A player joined the game (or more specifically, was added to the tab
/// list).
AddPlayer(PlayerInfo),
@@ -146,6 +144,7 @@ impl Plugin for EventsPlugin {
chat_listener,
login_listener,
spawn_listener,
+ #[cfg(feature = "packet-event")]
packet_listener,
add_player_listener,
update_player_listener,
@@ -215,9 +214,10 @@ pub fn tick_listener(query: Query<&LocalPlayerEvents, With<InstanceName>>) {
}
}
+#[cfg(feature = "packet-event")]
pub fn packet_listener(
query: Query<&LocalPlayerEvents>,
- mut events: EventReader<ReceiveGamePacketEvent>,
+ mut events: EventReader<super::packet::game::ReceiveGamePacketEvent>,
) {
for event in events.read() {
if let Ok(local_player_events) = query.get(event.entity) {
diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs
index 60531d3b..9afc0e11 100644
--- a/azalea-client/src/plugins/packet/game/mod.rs
+++ b/azalea-client/src/plugins/packet/game/mod.rs
@@ -532,7 +532,7 @@ impl GamePacketHandler<'_> {
tab_list.insert(updated_info.profile.uuid, info.clone());
add_player_events.send(AddPlayerEvent {
entity: self.player,
- info: info.clone(),
+ info,
});
} else if let Some(info) = tab_list.get_mut(&updated_info.profile.uuid) {
// `else if` because the block for add_player above