aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/player.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-client/src/player.rs')
-rwxr-xr-xazalea-client/src/player.rs36
1 files changed, 19 insertions, 17 deletions
diff --git a/azalea-client/src/player.rs b/azalea-client/src/player.rs
index a355831b..5db5c864 100755
--- a/azalea-client/src/player.rs
+++ b/azalea-client/src/player.rs
@@ -1,37 +1,39 @@
-use azalea_world::entity::Entity;
+use azalea_auth::game_profile::GameProfile;
+use azalea_chat::Component;
+use azalea_core::GameType;
+use azalea_world::entity::EntityData;
use azalea_world::World;
use uuid::Uuid;
-/// Something that has a world associated to it. Usually, this is a `Client`.
+/// Something that has a world associated to it. this is usually a `Client`.
pub trait WorldHaver {
fn world(&self) -> &World;
}
-/// A player in the world or tab list.
-#[derive(Default, Debug)]
-pub struct Player {
- /// The player's uuid.
+/// A player in the tab list.
+#[derive(Debug, Clone)]
+pub struct PlayerInfo {
+ pub profile: GameProfile,
+ /// The player's UUID.
pub uuid: Uuid,
- /// The player's entity id.
- pub entity_id: u32,
+ pub gamemode: GameType,
+ pub latency: i32,
+ /// The player's display name in the tab list.
+ pub display_name: Option<Component>,
}
-impl Player {
+impl PlayerInfo {
/// Get a reference to the entity of the player in the world.
- pub fn entity<'d>(&'d self, world: &'d World) -> Option<Entity<&World>> {
- world.entity(self.entity_id)
+ pub fn entity<'d>(&'d self, world: &'d World) -> Option<&EntityData> {
+ world.entity_by_uuid(&self.uuid)
}
/// Get a mutable reference to the entity of the player in the world.
- pub fn entity_mut<'d>(&'d self, world: &'d mut World) -> Option<Entity> {
- world.entity_mut(self.entity_id)
+ pub fn entity_mut<'d>(&'d mut self, world: &'d mut World) -> Option<&'d mut EntityData> {
+ world.entity_mut_by_uuid(&self.uuid)
}
pub fn set_uuid(&mut self, uuid: Uuid) {
self.uuid = uuid;
}
-
- pub fn set_entity_id(&mut self, entity_id: u32) {
- self.entity_id = entity_id;
- }
}