aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/client.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-07-15 02:06:19 -0500
committermat <git@matdoes.dev>2023-07-15 02:06:19 -0500
commit148f20381750be3e2c38a6bdaf8d339113da1b39 (patch)
tree893fc171b4228eb7c90d4df7c3394e22042a3d6b /azalea-client/src/client.rs
parent7405427199e5a994d4a6a706f84434a69cb7a7d9 (diff)
downloadazalea-drasl-148f20381750be3e2c38a6bdaf8d339113da1b39.tar.xz
fix auto respawn and fix entity metadata
Diffstat (limited to 'azalea-client/src/client.rs')
-rw-r--r--azalea-client/src/client.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 0b1fccc1..301d9197 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -20,7 +20,7 @@ use crate::{
use azalea_auth::{game_profile::GameProfile, sessionserver::ClientSessionServerError};
use azalea_chat::FormattedText;
use azalea_core::Vec3;
-use azalea_entity::{EntityPlugin, EntityUpdateSet, Local, Position};
+use azalea_entity::{metadata::Health, EntityPlugin, EntityUpdateSet, Local, Position};
use azalea_physics::{PhysicsPlugin, PhysicsSet};
use azalea_protocol::{
connect::{Connection, ConnectionError},
@@ -548,6 +548,12 @@ impl Client {
pub fn position(&self) -> Vec3 {
Vec3::from(&self.component::<Position>())
}
+ /// Get the health of this client.
+ ///
+ /// This is a shortcut for `*bot.component::<Health>()`.
+ pub fn health(&self) -> f32 {
+ *self.component::<Health>()
+ }
}
/// A bundle for the components that are present on a local player that received