diff options
| author | mat <git@matdoes.dev> | 2026-01-14 07:16:55 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-01-14 07:16:55 +0000 |
| commit | 6aec4bc3628a67276e556387d5ee9755e2e0db5c (patch) | |
| tree | c79e0a0e73b05b8027d420545fd3742bbe80598a | |
| parent | 704a9dc7c443222c60934a3723fbaaa89e312bbe (diff) | |
| download | azalea-drasl-6aec4bc3628a67276e556387d5ee9755e2e0db5c.tar.xz | |
fix jump penalty not being considered in pathfinder y heuristic
| -rw-r--r-- | azalea/src/pathfinder/goals.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/azalea/src/pathfinder/goals.rs b/azalea/src/pathfinder/goals.rs index 2c54b85a..dc933936 100644 --- a/azalea/src/pathfinder/goals.rs +++ b/azalea/src/pathfinder/goals.rs @@ -11,6 +11,7 @@ use azalea_world::ChunkStorage; use serde::{Deserialize, Serialize}; use super::costs::{COST_HEURISTIC, FALL_N_BLOCKS_COST, JUMP_ONE_BLOCK_COST}; +use crate::pathfinder::costs::JUMP_PENALTY; pub trait Goal: Debug + Send + Sync { #[must_use] @@ -76,8 +77,10 @@ impl Goal for XZGoal { fn y_heuristic(dy: f32) -> f32 { if dy > 0.0 { - *JUMP_ONE_BLOCK_COST * dy + (*JUMP_ONE_BLOCK_COST + JUMP_PENALTY) * dy } else { + // this assumes that we always descend 2 blocks at a time, which is fine because + // the heuristic should be an underestimate. FALL_N_BLOCKS_COST[2] / 2. * -dy } } |
