aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/entity_ref
diff options
context:
space:
mode:
Diffstat (limited to 'azalea/src/entity_ref')
-rw-r--r--azalea/src/entity_ref/mod.rs11
-rw-r--r--azalea/src/entity_ref/shared_impls.rs4
2 files changed, 13 insertions, 2 deletions
diff --git a/azalea/src/entity_ref/mod.rs b/azalea/src/entity_ref/mod.rs
index 2f49d975..d604fe00 100644
--- a/azalea/src/entity_ref/mod.rs
+++ b/azalea/src/entity_ref/mod.rs
@@ -132,4 +132,15 @@ impl EntityRef {
pub fn interact(&self) {
self.client.entity_interact(self.entity);
}
+
+ /// Look at this entity from the client that created the `EntityRef`.
+ pub fn look_at(&self) {
+ self.client.look_at(self.eye_position());
+ }
+
+ /// Returns the distance between the client's feet position and this
+ /// entity's feet position.
+ pub fn distance_to_client(&self) -> f64 {
+ self.position().distance_to(self.client.position())
+ }
}
diff --git a/azalea/src/entity_ref/shared_impls.rs b/azalea/src/entity_ref/shared_impls.rs
index 9ef396a0..5e2255c5 100644
--- a/azalea/src/entity_ref/shared_impls.rs
+++ b/azalea/src/entity_ref/shared_impls.rs
@@ -87,11 +87,11 @@ impl_entity_functions! {
}
Client:
- /// Get the health of this client.
+ /// Get the health of this client, typically in the range `0..=20`.
///
/// This is a shortcut for `*bot.component::<Health>()`.
EntityRef:
- /// Get the health of this entity.
+ /// Get the health of this entity, typically in the range `0..=20`.
///
/// Also see [`Client::health`].
pub fn health(&self) -> f32 {