diff options
| author | mat <git@matdoes.dev> | 2026-01-19 00:27:32 -0330 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-01-19 00:27:32 -0330 |
| commit | f34bd98201087bb9f6bdc833ed59a3e36c92b235 (patch) | |
| tree | 078c1a0bde394327161a4cbd49d68536084575e1 | |
| parent | 544ea6ad46d7f4d621104a9063dbbe1c85284111 (diff) | |
| download | azalea-drasl-f34bd98201087bb9f6bdc833ed59a3e36c92b235.tar.xz | |
minor pathfinder cleanup
| -rw-r--r-- | azalea/src/pathfinder/moves/basic.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs index 38132d2e..19de5f59 100644 --- a/azalea/src/pathfinder/moves/basic.rs +++ b/azalea/src/pathfinder/moves/basic.rs @@ -36,32 +36,28 @@ fn forward_move(ctx: &mut MovesCtx, pos: RelBlockPos) { for dir in CardinalDirection::iter() { let offset = RelBlockPos::new(dir.x(), 0, dir.z()); - let mut cost = base_cost; - - let new_position = pos + offset; + let new_pos = pos + offset; let break_cost = if currently_in_water { - let dest_in_water = ctx.world.is_block_water(new_position); + let dest_in_water = ctx.world.is_block_water(new_pos); if !dest_in_water { continue; } ctx.world - .cost_for_breaking_block(new_position.up(1), ctx.mining_cache) + .cost_for_breaking_block(new_pos.up(1), ctx.mining_cache) } else { - ctx.world.cost_for_standing(new_position, ctx.mining_cache) + ctx.world.cost_for_standing(new_pos, ctx.mining_cache) }; if break_cost == f32::INFINITY { continue; } - // TODO: benchmark this - // cost = cost.algebraic_add(break_cost); - cost += break_cost; + let cost = base_cost + break_cost; ctx.edges.push(Edge { movement: astar::Movement { - target: new_position, + target: new_pos, data: MoveData { execute: &execute_forward_move, is_reached: &default_is_reached, |
