diff options
| author | Raeders <38367311+nebula161@users.noreply.github.com> | 2026-01-23 23:04:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-23 22:04:54 -0600 |
| commit | d665924eb2163fc8afe256e502a39e72ad0e4a42 (patch) | |
| tree | 5050630905b9802ef254e4352ac6d5c23116cacc /azalea-client/src/local_player.rs | |
| parent | 4ab3609244d4eb87c3087f69f48083d9413a1cb3 (diff) | |
| download | azalea-drasl-d665924eb2163fc8afe256e502a39e72ad0e4a42.tar.xz | |
Implement SetExperience (#307)
Diffstat (limited to 'azalea-client/src/local_player.rs')
| -rw-r--r-- | azalea-client/src/local_player.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/azalea-client/src/local_player.rs b/azalea-client/src/local_player.rs index 444b2fcc..1a2f059f 100644 --- a/azalea-client/src/local_player.rs +++ b/azalea-client/src/local_player.rs @@ -7,7 +7,7 @@ use derive_more::{Deref, DerefMut}; use parking_lot::RwLock; use uuid::Uuid; -use crate::{ClientInformation, player::PlayerInfo}; +use crate::{player::PlayerInfo, ClientInformation}; /// A component that keeps strong references to our [`PartialWorld`] and /// [`World`] for local players. @@ -104,6 +104,27 @@ impl Hunger { } } +/// The player's experience state. +#[derive(Clone, Component, Debug)] +pub struct Experience { + /// Progress towards the next level, in the range 0.0..1.0. + pub progress: f32, + /// The current experience level. You'll mostly be using this. + pub level: u32, + /// Total experience points accumulated. + pub total: u32, +} + +impl Default for Experience { + fn default() -> Self { + Experience { + progress: 0.0, + level: 0, + total: 0, + } + } +} + impl WorldHolder { /// Create a new `WorldHolder` for the given entity. /// |
