aboutsummaryrefslogtreecommitdiff
path: root/azalea/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea/src')
-rw-r--r--azalea/src/pathfinder/costs.rs10
-rw-r--r--azalea/src/pathfinder/moves/basic.rs4
2 files changed, 8 insertions, 6 deletions
diff --git a/azalea/src/pathfinder/costs.rs b/azalea/src/pathfinder/costs.rs
index 8465fff3..99b3d3d5 100644
--- a/azalea/src/pathfinder/costs.rs
+++ b/azalea/src/pathfinder/costs.rs
@@ -3,9 +3,9 @@ use std::sync::LazyLock;
use num_traits::Float;
// based on https://github.com/cabaletta/baritone/blob/1.20.1/src/api/java/baritone/api/pathing/movement/ActionCosts.java
-pub const WALK_ONE_BLOCK_COST: f32 = 20. / 4.317;
-pub const SPRINT_ONE_BLOCK_COST: f32 = 20. / 5.612;
-pub const FALL_ONE_BLOCK_COST: f32 = 0.5;
+pub const WALK_ONE_BLOCK_COST: f32 = 20. / 4.317; // 4.633
+pub const SPRINT_ONE_BLOCK_COST: f32 = 20. / 5.612; // 3.564
+pub const FALL_ONE_BLOCK_COST: f32 = 1.;
pub const WALK_OFF_BLOCK_COST: f32 = WALK_ONE_BLOCK_COST * 0.8;
pub const SPRINT_MULTIPLIER: f32 = SPRINT_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;
pub const JUMP_PENALTY: f32 = 2.;
@@ -13,7 +13,7 @@ pub const JUMP_PENALTY: f32 = 2.;
pub static FALL_1_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(1.25));
pub static FALL_0_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(0.25));
pub static JUMP_ONE_BLOCK_COST: LazyLock<f32> =
- LazyLock::new(|| *FALL_1_25_BLOCKS_COST - *FALL_0_25_BLOCKS_COST);
+ LazyLock::new(|| *FALL_1_25_BLOCKS_COST - *FALL_0_25_BLOCKS_COST); // 3.163
fn velocity(ticks: usize) -> f32 {
(0.98.powi(ticks.try_into().unwrap()) - 1.) * -3.92
@@ -21,7 +21,7 @@ fn velocity(ticks: usize) -> f32 {
fn distance_to_ticks(distance: f32) -> f32 {
if distance == 0. {
- // // Avoid 0/0 NaN
+ // Avoid 0/0 NaN
return 0.;
}
let mut temp_distance = distance;
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs
index 412f463e..dfb90bd0 100644
--- a/azalea/src/pathfinder/moves/basic.rs
+++ b/azalea/src/pathfinder/moves/basic.rs
@@ -172,7 +172,9 @@ fn descend_move(ctx: &PathfinderCtx, pos: BlockPos) -> Vec<Edge> {
continue;
}
- let cost = SPRINT_ONE_BLOCK_COST + FALL_ONE_BLOCK_COST * fall_distance as f32;
+ let cost = SPRINT_ONE_BLOCK_COST
+ + WALK_OFF_BLOCK_COST
+ + FALL_ONE_BLOCK_COST * fall_distance as f32;
edges.push(Edge {
movement: astar::Movement {