aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--azalea-client/src/client.rs6
-rw-r--r--azalea-world/src/entity/metadata.rs3
2 files changed, 8 insertions, 1 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 282de48f..2aef1709 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -910,6 +910,12 @@ impl Client {
Ok(())
}
+
+ /// Get the player metadata for ourselves. You can use this to get your
+ /// health, xp score, and other useful information.
+ pub fn metadata(&self) -> metadata::Player {
+ self.entity().metadata.clone().into_player().unwrap()
+ }
}
impl<T> From<std::sync::PoisonError<T>> for HandleError {
diff --git a/azalea-world/src/entity/metadata.rs b/azalea-world/src/entity/metadata.rs
index a031ade2..a74635b3 100644
--- a/azalea-world/src/entity/metadata.rs
+++ b/azalea-world/src/entity/metadata.rs
@@ -6,6 +6,7 @@ use super::{EntityDataValue, Pose, Rotations, VillagerData};
use azalea_block::BlockState;
use azalea_chat::Component;
use azalea_core::{BlockPos, Direction, Particle, Slot};
+use enum_as_inner::EnumAsInner;
use std::{
collections::VecDeque,
ops::{Deref, DerefMut},
@@ -7908,7 +7909,7 @@ impl DerefMut for AbstractTameable {
}
}
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, EnumAsInner)]
pub enum EntityMetadata {
Allay(Allay),
AreaEffectCloud(AreaEffectCloud),