diff options
| author | mat <git@matdoes.dev> | 2025-12-28 09:06:47 -0330 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-12-28 09:06:47 -0330 |
| commit | 839d536e8020b291bc1d213a5e8e823dc513a940 (patch) | |
| tree | 60cab8b908ad53af0126e2cb1dec670d073936a3 /azalea/src/client_impl/interact.rs | |
| parent | 5b1a78baf757897532be8c308a37c99fb2ca3352 (diff) | |
| download | azalea-drasl-839d536e8020b291bc1d213a5e8e823dc513a940.tar.xz | |
add a few more functions for getting common components to Client
Diffstat (limited to 'azalea/src/client_impl/interact.rs')
| -rw-r--r-- | azalea/src/client_impl/interact.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/azalea/src/client_impl/interact.rs b/azalea/src/client_impl/interact.rs index 8a9cf475..b3cda1e2 100644 --- a/azalea/src/client_impl/interact.rs +++ b/azalea/src/client_impl/interact.rs @@ -1,11 +1,17 @@ -use azalea_client::interact::{EntityInteractEvent, StartUseItemEvent}; -use azalea_core::position::BlockPos; +use azalea_client::interact::{EntityInteractEvent, StartUseItemEvent, pick::HitResultComponent}; +use azalea_core::{hit_result::HitResult, position::BlockPos}; use azalea_protocol::packets::game::s_interact::InteractionHand; use bevy_ecs::entity::Entity; use crate::Client; impl Client { + /// Returns the current [`HitResult`], which is the block or entity in the + /// client's crosshair. + pub fn hit_result(&self) -> HitResult { + (**self.component::<HitResultComponent>()).clone() + } + /// Right-click a block. /// /// The behavior of this depends on the target block, |
