aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/player.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-06-02 03:14:08 -0430
committermat <git@matdoes.dev>2025-06-02 03:14:08 -0430
commit0569862a1b1f46f1854f4eafd1569359397f2515 (patch)
tree01f20f6b078db41d34f08d7f52000f9fb46f7c45 /azalea-client/src/player.rs
parentd7cd30505954d841f05d85a4cfd74412739778dd (diff)
downloadazalea-drasl-0569862a1b1f46f1854f4eafd1569359397f2515.tar.xz
fix issues related to pathfinder mining
Diffstat (limited to 'azalea-client/src/player.rs')
-rw-r--r--azalea-client/src/player.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/azalea-client/src/player.rs b/azalea-client/src/player.rs
index d774e877..d696d133 100644
--- a/azalea-client/src/player.rs
+++ b/azalea-client/src/player.rs
@@ -3,12 +3,14 @@ use azalea_chat::FormattedText;
use azalea_core::game_type::GameMode;
use azalea_entity::indexing::EntityUuidIndex;
use bevy_ecs::{
+ component::Component,
event::EventReader,
system::{Commands, Res},
};
+use derive_more::{Deref, DerefMut};
use uuid::Uuid;
-use crate::{GameProfileComponent, packet::game::AddPlayerEvent};
+use crate::packet::game::AddPlayerEvent;
/// A player in the tab list.
#[derive(Debug, Clone)]
@@ -29,6 +31,14 @@ pub struct PlayerInfo {
pub display_name: Option<Box<FormattedText>>,
}
+/// A component only present in players that contains the [`GameProfile`] (which
+/// you can use to get a player's name).
+///
+/// Note that it's possible for this to be missing in a player if the server
+/// never sent the player info for them (though this is uncommon).
+#[derive(Component, Clone, Debug, Deref, DerefMut)]
+pub struct GameProfileComponent(pub GameProfile);
+
/// Add a [`GameProfileComponent`] when an [`AddPlayerEvent`] is received.
/// Usually the `GameProfileComponent` will be added from the
/// `ClientboundGamePacket::AddPlayer` handler though.