diff options
| author | mat <git@matdoes.dev> | 2025-05-10 06:22:08 +0330 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-05-10 06:22:08 +0330 |
| commit | e1d3b902ba08170e4ee82c53f216445f57fbc47e (patch) | |
| tree | e383f7bb54edf654016a5c370786e6cb67ed28c4 /azalea | |
| parent | e9b3128103d203ad4902a40124e4d22a012c196a (diff) | |
| download | azalea-drasl-e1d3b902ba08170e4ee82c53f216445f57fbc47e.tar.xz | |
add StartUseItemEvent and improve code related to interactions
Diffstat (limited to 'azalea')
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 11 | ||||
| -rw-r--r-- | azalea/src/pathfinder/goals.rs | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index 31b0ff91..0bac22d4 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -104,10 +104,10 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { let hit_result = *source.bot.component::<HitResultComponent>(); - if hit_result.miss { + let Some(hit_result) = hit_result.as_block_hit_result_if_not_miss() else { source.reply("I'm not looking at anything"); return 1; - } + }; let block_pos = hit_result.block_pos; let block = source.bot.world().read().get_block_state(&block_pos); @@ -174,6 +174,13 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { 1 })); + commands.register(literal("startuseitem").executes(|ctx: &Ctx| { + let source = ctx.source.lock(); + source.bot.start_use_item(); + source.reply("Ok!"); + 1 + })); + commands.register(literal("debugecsleak").executes(|ctx: &Ctx| { let source = ctx.source.lock(); diff --git a/azalea/src/pathfinder/goals.rs b/azalea/src/pathfinder/goals.rs index 9052c8fd..3ef45993 100644 --- a/azalea/src/pathfinder/goals.rs +++ b/azalea/src/pathfinder/goals.rs @@ -212,7 +212,7 @@ impl Goal for ReachBlockPosGoal { let eye_position = n.to_vec3_floored() + Vec3::new(0.5, 1.62, 0.5); let look_direction = crate::direction_looking_at(&eye_position, &self.pos.center()); - let block_hit_result = azalea_client::interact::pick( + let block_hit_result = azalea_client::interact::pick_block( &look_direction, &eye_position, &self.chunk_storage, |
