aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder/moves
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2026-01-05 08:29:53 +0330
committermat <git@matdoes.dev>2026-01-05 08:29:53 +0330
commitdb9a9e53ca18911fb2045b7d6af4ed6df388eaaa (patch)
tree730e6dda7e9ed41a0595f8a187b3561eb6e2caa1 /azalea/src/pathfinder/moves
parentc50a8662afeadfce50f64600efa497b07e9bce86 (diff)
downloadazalea-drasl-db9a9e53ca18911fb2045b7d6af4ed6df388eaaa.tar.xz
fix panic in a_star and some prep for pathfinder swimming
Diffstat (limited to 'azalea/src/pathfinder/moves')
-rw-r--r--azalea/src/pathfinder/moves/mod.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index fc574a4c..33c34c3b 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -217,10 +217,22 @@ pub struct IsReachedCtx<'a> {
#[must_use]
pub fn default_is_reached(
IsReachedCtx {
- position, target, ..
+ position,
+ target,
+ physics,
+ ..
}: IsReachedCtx,
) -> bool {
- player_pos_to_block_pos(position) == target
+ let block_pos = player_pos_to_block_pos(position);
+ if block_pos == target {
+ return true;
+ }
+ // it's fine if we slightly go under the target while swimming
+ if physics.is_in_water() && block_pos.up(1) == target {
+ return true;
+ }
+
+ false
}
pub struct PathfinderCtx<'a> {