diff options
| author | mat <git@matdoes.dev> | 2025-05-06 17:51:50 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-05-06 17:51:50 -0500 |
| commit | 685aeff13f91e00073683757112cf0caafcb7998 (patch) | |
| tree | 082a5c819a892ea15775bd50f62027f083b5f2ab /azalea | |
| parent | 7b442368daf29b43e20e122aac440e10d2fc7464 (diff) | |
| download | azalea-drasl-685aeff13f91e00073683757112cf0caafcb7998.tar.xz | |
fix pathfinder descending onto non-full blocks
Diffstat (limited to 'azalea')
| -rw-r--r-- | azalea/src/pathfinder/moves/basic.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs index c7fccf26..354472a7 100644 --- a/azalea/src/pathfinder/moves/basic.rs +++ b/azalea/src/pathfinder/moves/basic.rs @@ -324,6 +324,7 @@ pub fn descend_is_reached( target, start, position, + physics, .. }: IsReachedCtx, ) -> bool { @@ -333,8 +334,14 @@ pub fn descend_is_reached( start.z + (target.z - start.z) * 2, ); - (BlockPos::from(position) == target || BlockPos::from(position) == dest_ahead) - && (position.y - target.y as f64) < 0.5 + if BlockPos::from(position) == target || BlockPos::from(position) == dest_ahead { + if (position.y - target.y as f64) < 0.5 { + return true; + } + } else if BlockPos::from(position).up(1) == target && physics.on_ground() { + return true; + } + false } fn descend_forward_1_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) { |
