diff options
| author | mat <git@matdoes.dev> | 2025-06-02 03:14:08 -0430 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-02 03:14:08 -0430 |
| commit | 0569862a1b1f46f1854f4eafd1569359397f2515 (patch) | |
| tree | 01f20f6b078db41d34f08d7f52000f9fb46f7c45 /azalea-client/src/local_player.rs | |
| parent | d7cd30505954d841f05d85a4cfd74412739778dd (diff) | |
| download | azalea-drasl-0569862a1b1f46f1854f4eafd1569359397f2515.tar.xz | |
fix issues related to pathfinder mining
Diffstat (limited to 'azalea-client/src/local_player.rs')
| -rw-r--r-- | azalea-client/src/local_player.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/azalea-client/src/local_player.rs b/azalea-client/src/local_player.rs index ee318c06..4a937ec7 100644 --- a/azalea-client/src/local_player.rs +++ b/azalea-client/src/local_player.rs @@ -4,7 +4,6 @@ use std::{ sync::{Arc, PoisonError}, }; -use azalea_auth::game_profile::GameProfile; use azalea_core::game_type::GameMode; use azalea_protocol::packets::game::c_player_abilities::ClientboundPlayerAbilities; use azalea_world::{Instance, PartialInstance}; @@ -16,7 +15,7 @@ use tokio::sync::mpsc; use tracing::error; use uuid::Uuid; -use crate::{ClientInformation, PlayerInfo, events::Event as AzaleaEvent}; +use crate::{ClientInformation, events::Event as AzaleaEvent, player::PlayerInfo}; /// A component that keeps strong references to our [`PartialInstance`] and /// [`Instance`] for local players. @@ -40,14 +39,6 @@ pub struct InstanceHolder { pub instance: Arc<RwLock<Instance>>, } -/// 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); - /// The gamemode of a local player. For a non-local player, you can look up the /// player in the [`TabList`]. #[derive(Component, Clone, Debug, Copy)] @@ -55,6 +46,14 @@ pub struct LocalGameMode { pub current: GameMode, pub previous: Option<GameMode>, } +impl From<GameMode> for LocalGameMode { + fn from(current: GameMode) -> Self { + LocalGameMode { + current, + previous: None, + } + } +} /// A component that contains the abilities the player has, like flying /// or instantly breaking blocks. This is only present on local players. @@ -92,7 +91,7 @@ pub struct PermissionLevel(pub u8); /// tab list. /// /// ``` -/// # use azalea_client::TabList; +/// # use azalea_client::local_player::TabList; /// # fn example(client: &azalea_client::Client) { /// let tab_list = client.component::<TabList>(); /// println!("Online players:"); |
