aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-10-13 13:55:43 +1200
committermat <git@matdoes.dev>2025-10-13 13:55:43 +1200
commit7a24de8cbdebae720767b552aac9f0ba75e8c219 (patch)
tree5e5d7a51270a979f7855f4b4423239c20e646b0a /azalea-core/src
parent9aaf893588eaecd62f6b146897cbce8a3a5058b5 (diff)
downloadazalea-drasl-7a24de8cbdebae720767b552aac9f0ba75e8c219.tar.xz
add Client::entity_interact and EntityInteractEvent for convenience
Diffstat (limited to 'azalea-core/src')
-rw-r--r--azalea-core/src/hit_result.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/azalea-core/src/hit_result.rs b/azalea-core/src/hit_result.rs
index 96ff32c9..2f3d2403 100644
--- a/azalea-core/src/hit_result.rs
+++ b/azalea-core/src/hit_result.rs
@@ -43,8 +43,7 @@ impl HitResult {
matches!(self, HitResult::Block(r) if !r.miss)
}
- /// Returns the [`BlockHitResult`], if we were looking at a block and it
- /// wasn't a miss.
+ /// Returns the [`BlockHitResult`], if we were looking at a block.
pub fn as_block_hit_result_if_not_miss(&self) -> Option<&BlockHitResult> {
if let HitResult::Block(r) = self
&& !r.miss
@@ -54,6 +53,16 @@ impl HitResult {
None
}
}
+
+ /// Returns the [`EntityHitResult`], if we were looking at an entity and it
+ /// wasn't a miss.
+ pub fn as_entity_hit_result(&self) -> Option<&EntityHitResult> {
+ if let HitResult::Entity(r) = self {
+ Some(r)
+ } else {
+ None
+ }
+ }
}
#[derive(Debug, Clone, PartialEq)]