diff options
| author | mat <git@matdoes.dev> | 2023-07-15 16:35:23 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-07-15 16:35:23 -0500 |
| commit | a839c6a923a737fab61536cec0258fdd83106368 (patch) | |
| tree | 8dfdb984da72dd60ad77a5f171e7db4efd296103 /azalea-client/src/client.rs | |
| parent | cde7e35046b726b07bf3e067c080b85a12b2fd74 (diff) | |
| download | azalea-drasl-a839c6a923a737fab61536cec0258fdd83106368.tar.xz | |
fix brigadier booleans
Diffstat (limited to 'azalea-client/src/client.rs')
| -rw-r--r-- | azalea-client/src/client.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index f7fcb16c..a7cceaed 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -21,7 +21,7 @@ use crate::{ use azalea_auth::{game_profile::GameProfile, sessionserver::ClientSessionServerError}; use azalea_chat::FormattedText; use azalea_core::Vec3; -use azalea_entity::{metadata::Health, EntityPlugin, EntityUpdateSet, Local, Position}; +use azalea_entity::{metadata::Health, EntityPlugin, EntityUpdateSet, EyeHeight, Local, Position}; use azalea_physics::{PhysicsPlugin, PhysicsSet}; use azalea_protocol::{ connect::{Connection, ConnectionError}, @@ -550,6 +550,15 @@ impl Client { pub fn position(&self) -> Vec3 { Vec3::from(&self.component::<Position>()) } + + /// Get the position of this client's eyes. + /// + /// This is a shortcut for + /// `bot.position().up(bot.component::<EyeHeight>())`. + pub fn eye_position(&self) -> Vec3 { + self.position().up((*self.component::<EyeHeight>()) as f64) + } + /// Get the health of this client. /// /// This is a shortcut for `*bot.component::<Health>()`. |
