aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2026-01-17 11:44:04 -1345
committermat <git@matdoes.dev>2026-01-17 11:44:04 -1345
commit81e5a0200a4fe5438ab67c82600f063410d637c0 (patch)
tree9cb38f58a56293c52ba131907ad23b18a0319af0
parent56bf94ac9ec5614ddc4ab5168a8c3fb5036242a5 (diff)
downloadazalea-drasl-81e5a0200a4fe5438ab67c82600f063410d637c0.tar.xz
rename PathfinderCtx to MovesCtx
-rw-r--r--azalea/examples/testbot/commands/debug.rs4
-rw-r--r--azalea/src/pathfinder/mod.rs4
-rw-r--r--azalea/src/pathfinder/moves/basic.rs14
-rw-r--r--azalea/src/pathfinder/moves/mod.rs7
-rw-r--r--azalea/src/pathfinder/moves/parkour.rs10
-rw-r--r--azalea/src/pathfinder/moves/uncommon.rs6
6 files changed, 22 insertions, 23 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index ac1f31e9..12f6d362 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -10,7 +10,7 @@ use azalea::{
packet::game,
pathfinder::{
ExecutingPath, Pathfinder, custom_state::CustomPathfinderStateRef, mining::MiningCache,
- moves::PathfinderCtx, positions::RelBlockPos, world::CachedWorld,
+ moves::MovesCtx, positions::RelBlockPos, world::CachedWorld,
},
};
use azalea_core::hit_result::HitResult;
@@ -205,7 +205,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
let custom_state = CustomPathfinderStateRef::default();
azalea::pathfinder::moves::default_move(
- &mut PathfinderCtx {
+ &mut MovesCtx {
edges: &mut edges,
world: &cached_world,
mining_cache: &mining_cache,
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs
index 41887bfd..ee5c50c0 100644
--- a/azalea/src/pathfinder/mod.rs
+++ b/azalea/src/pathfinder/mod.rs
@@ -64,7 +64,7 @@ use crate::{
query::{With, Without},
system::{Commands, Query, Res},
},
- pathfinder::{astar::a_star, moves::PathfinderCtx, world::CachedWorld},
+ pathfinder::{astar::a_star, moves::MovesCtx, world::CachedWorld},
};
#[derive(Clone, Default)]
@@ -728,7 +728,7 @@ pub fn call_successors_fn(
pos: RelBlockPos,
) -> Vec<astar::Edge<RelBlockPos, moves::MoveData>> {
let mut edges = Vec::with_capacity(16);
- let mut ctx = PathfinderCtx {
+ let mut ctx = MovesCtx {
edges: &mut edges,
world: cached_world,
mining_cache,
diff --git a/azalea/src/pathfinder/moves/basic.rs b/azalea/src/pathfinder/moves/basic.rs
index be0f3b99..38132d2e 100644
--- a/azalea/src/pathfinder/moves/basic.rs
+++ b/azalea/src/pathfinder/moves/basic.rs
@@ -7,12 +7,12 @@ use azalea_core::{
position::{BlockPos, Vec3},
};
-use super::{Edge, ExecuteCtx, IsReachedCtx, MoveData, PathfinderCtx, default_is_reached};
+use super::{Edge, ExecuteCtx, IsReachedCtx, MoveData, MovesCtx, default_is_reached};
use crate::pathfinder::{
astar, costs::*, moves::BARITONE_COMPAT, player_pos_to_block_pos, positions::RelBlockPos,
};
-pub fn basic_move(ctx: &mut PathfinderCtx, node: RelBlockPos) {
+pub fn basic_move(ctx: &mut MovesCtx, node: RelBlockPos) {
forward_move(ctx, node);
ascend_move(ctx, node);
descend_move(ctx, node);
@@ -20,7 +20,7 @@ pub fn basic_move(ctx: &mut PathfinderCtx, node: RelBlockPos) {
downward_move(ctx, node);
}
-fn forward_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn forward_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
let mut base_cost = SPRINT_ONE_BLOCK_COST;
// it's for us cheaper to have the water cost be applied when leaving the water
// rather than when entering
@@ -87,7 +87,7 @@ fn execute_forward_move(mut ctx: ExecuteCtx) {
ctx.sprint(SprintDirection::Forward);
}
-fn ascend_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn ascend_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
// the block we're standing on must be solid (so we don't try to ascend from a
// bottom slab to a normal block in a way that's not possible)
@@ -248,7 +248,7 @@ fn cardinal_direction_to_facing_property(dir: CardinalDirection) -> properties::
}
}
-fn descend_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn descend_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
for dir in CardinalDirection::iter() {
let dir_delta = RelBlockPos::new(dir.x(), 0, dir.z());
let new_horizontal_position = pos + dir_delta;
@@ -397,7 +397,7 @@ pub fn descend_is_reached(
false
}
-fn diagonal_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn diagonal_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
let mut base_cost = SPRINT_ONE_BLOCK_COST;
let currently_in_water = ctx.world.is_block_water(pos);
@@ -485,7 +485,7 @@ fn execute_diagonal_move(mut ctx: ExecuteCtx) {
}
/// Go directly down, usually by mining.
-fn downward_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn downward_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
// make sure we land on a solid block after breaking the one below us
if !ctx.world.is_block_solid(pos.down(2)) {
return;
diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs
index 95d3ae35..1ce541c8 100644
--- a/azalea/src/pathfinder/moves/mod.rs
+++ b/azalea/src/pathfinder/moves/mod.rs
@@ -34,7 +34,7 @@ use crate::{
type Edge = astar::Edge<RelBlockPos, MoveData>;
-pub type SuccessorsFn = fn(&mut PathfinderCtx, RelBlockPos);
+pub type SuccessorsFn = fn(&mut MovesCtx, RelBlockPos);
/// Re-implement certain bugs and quirks that Baritone has, and disable
/// movements that Baritone doesn't have.
@@ -42,7 +42,7 @@ pub type SuccessorsFn = fn(&mut PathfinderCtx, RelBlockPos);
/// Meant to help with debugging when directly comparing against Baritone.
pub const BARITONE_COMPAT: bool = false;
-pub fn default_move(ctx: &mut PathfinderCtx, node: RelBlockPos) {
+pub fn default_move(ctx: &mut MovesCtx, node: RelBlockPos) {
basic::basic_move(ctx, node);
parkour::parkour_move(ctx, node);
uncommon::uncommon_move(ctx, node);
@@ -232,10 +232,9 @@ pub fn default_is_reached(
false
}
-pub struct PathfinderCtx<'a> {
+pub struct MovesCtx<'a> {
pub edges: &'a mut Vec<Edge>,
pub world: &'a CachedWorld,
pub mining_cache: &'a MiningCache,
-
pub custom_state: &'a CustomPathfinderStateRef,
}
diff --git a/azalea/src/pathfinder/moves/parkour.rs b/azalea/src/pathfinder/moves/parkour.rs
index b6b97465..4550ab95 100644
--- a/azalea/src/pathfinder/moves/parkour.rs
+++ b/azalea/src/pathfinder/moves/parkour.rs
@@ -2,10 +2,10 @@ use azalea_client::{SprintDirection, WalkDirection};
use azalea_core::{direction::CardinalDirection, position::BlockPos};
use tracing::trace;
-use super::{Edge, ExecuteCtx, IsReachedCtx, MoveData, PathfinderCtx};
+use super::{Edge, ExecuteCtx, IsReachedCtx, MoveData, MovesCtx};
use crate::pathfinder::{astar, costs::*, player_pos_to_block_pos, positions::RelBlockPos};
-pub fn parkour_move(ctx: &mut PathfinderCtx, node: RelBlockPos) {
+pub fn parkour_move(ctx: &mut MovesCtx, node: RelBlockPos) {
if !ctx.world.is_block_solid(node.down(1)) {
// we can only parkour from solid blocks (not just standable blocks like slabs)
return;
@@ -16,7 +16,7 @@ pub fn parkour_move(ctx: &mut PathfinderCtx, node: RelBlockPos) {
parkour_forward_3_move(ctx, node);
}
-fn parkour_forward_1_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn parkour_forward_1_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
for dir in CardinalDirection::iter() {
let gap_offset = RelBlockPos::new(dir.x(), 0, dir.z());
let offset = RelBlockPos::new(dir.x() * 2, 0, dir.z() * 2);
@@ -70,7 +70,7 @@ fn parkour_forward_1_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
}
}
-fn parkour_forward_2_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn parkour_forward_2_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
'dir: for dir in CardinalDirection::iter() {
let gap_1_offset = RelBlockPos::new(dir.x(), 0, dir.z());
let gap_2_offset = RelBlockPos::new(dir.x() * 2, 0, dir.z() * 2);
@@ -128,7 +128,7 @@ fn parkour_forward_2_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
}
}
-fn parkour_forward_3_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+fn parkour_forward_3_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
'dir: for dir in CardinalDirection::iter() {
let gap_1_offset = RelBlockPos::new(dir.x(), 0, dir.z());
let gap_2_offset = RelBlockPos::new(dir.x() * 2, 0, dir.z() * 2);
diff --git a/azalea/src/pathfinder/moves/uncommon.rs b/azalea/src/pathfinder/moves/uncommon.rs
index bc85333e..507cdc07 100644
--- a/azalea/src/pathfinder/moves/uncommon.rs
+++ b/azalea/src/pathfinder/moves/uncommon.rs
@@ -6,20 +6,20 @@ use crate::pathfinder::{
astar::{self, Edge},
costs::{CENTER_AFTER_FALL_COST, FALL_N_BLOCKS_COST, WALK_OFF_BLOCK_COST, WALK_ONE_BLOCK_COST},
moves::{
- BARITONE_COMPAT, MoveData, PathfinderCtx,
+ BARITONE_COMPAT, MoveData, MovesCtx,
basic::{descend_is_reached, execute_descend_move},
},
positions::RelBlockPos,
};
-pub fn uncommon_move(ctx: &mut PathfinderCtx, node: RelBlockPos) {
+pub fn uncommon_move(ctx: &mut MovesCtx, node: RelBlockPos) {
if BARITONE_COMPAT {
return;
}
descend_forward_1_move(ctx, node);
}
-pub fn descend_forward_1_move(ctx: &mut PathfinderCtx, pos: RelBlockPos) {
+pub fn descend_forward_1_move(ctx: &mut MovesCtx, pos: RelBlockPos) {
for dir in CardinalDirection::iter() {
let dir_delta = RelBlockPos::new(dir.x(), 0, dir.z());
let gap_horizontal_position = pos + dir_delta;