diff options
| author | mat <git@matdoes.dev> | 2025-10-13 13:55:43 +1200 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-10-13 13:55:43 +1200 |
| commit | 7a24de8cbdebae720767b552aac9f0ba75e8c219 (patch) | |
| tree | 5e5d7a51270a979f7855f4b4423239c20e646b0a /azalea-core | |
| parent | 9aaf893588eaecd62f6b146897cbce8a3a5058b5 (diff) | |
| download | azalea-drasl-7a24de8cbdebae720767b552aac9f0ba75e8c219.tar.xz | |
add Client::entity_interact and EntityInteractEvent for convenience
Diffstat (limited to 'azalea-core')
| -rw-r--r-- | azalea-core/src/hit_result.rs | 13 |
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)] |
