diff options
| author | mat <git@matdoes.dev> | 2024-12-26 12:36:41 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2024-12-26 12:36:41 +0000 |
| commit | 33e1a1326a462263aa578b5095c3c37160345c77 (patch) | |
| tree | 05c9920a8d1dca7185f37a98940acce1ded50689 /azalea/examples | |
| parent | 344834c72429e36f8d0612b8118f22bf007e70bc (diff) | |
| download | azalea-drasl-33e1a1326a462263aa578b5095c3c37160345c77.tar.xz | |
patch path on timeout instead of recalculating everything
Diffstat (limited to 'azalea/examples')
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index ab323b2f..0718bcab 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -4,6 +4,7 @@ use azalea::{ brigadier::prelude::*, entity::{LookDirection, Position}, interact::HitResultComponent, + pathfinder::{ExecutingPath, Pathfinder}, world::MinecraftEntityId, BlockPos, }; @@ -117,4 +118,34 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { 1 })), ))); + + commands.register(literal("pathfinderstate").executes(|ctx: &Ctx| { + let source = ctx.source.lock(); + let pathfinder = source.bot.get_component::<Pathfinder>(); + let Some(pathfinder) = pathfinder else { + source.reply("I don't have the Pathfinder ocmponent"); + return 1; + }; + source.reply(&format!( + "pathfinder.is_calculating: {}", + pathfinder.is_calculating + )); + + let executing_path = source.bot.get_component::<ExecutingPath>(); + let Some(executing_path) = executing_path else { + source.reply("I'm not executing a path"); + return 1; + }; + source.reply(&format!( + "is_path_partial: {}, path.len: {}, queued_path.len: {}", + executing_path.is_path_partial, + executing_path.path.len(), + if let Some(queued) = executing_path.queued_path { + queued.len().to_string() + } else { + "n/a".to_string() + }, + )); + 1 + })); } |
