feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
namespace MinecraftClient.Pathing.Core
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A* search node. Stored in the open/closed sets during pathfinding.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class PathNode
|
|
|
|
|
{
|
|
|
|
|
public readonly int X;
|
|
|
|
|
public readonly int Y;
|
|
|
|
|
public readonly int Z;
|
|
|
|
|
|
|
|
|
|
public double GCost;
|
|
|
|
|
public double HCost;
|
|
|
|
|
public double FCost => GCost + HCost;
|
|
|
|
|
|
|
|
|
|
public PathNode? Parent;
|
|
|
|
|
public MoveType MoveUsed;
|
2026-04-18 16:04:45 +00:00
|
|
|
public ParkourProfile ParkourProfile;
|
2026-04-19 17:03:03 +00:00
|
|
|
public EntryPreparationState EntryPreparation;
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
|
|
|
|
|
public int HeapIndex;
|
|
|
|
|
public bool IsOpen;
|
|
|
|
|
public bool IsClosed;
|
|
|
|
|
|
|
|
|
|
public PathNode(int x, int y, int z)
|
|
|
|
|
{
|
|
|
|
|
X = x;
|
|
|
|
|
Y = y;
|
|
|
|
|
Z = z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public long PackedPosition => Pack(X, Y, Z);
|
|
|
|
|
|
|
|
|
|
public static long Pack(int x, int y, int z)
|
|
|
|
|
{
|
2026-04-11 02:08:16 +08:00
|
|
|
// 26 bits for X (0..60M), 26 bits for Z (0..60M), 12 bits for Y (-2048..2047)
|
|
|
|
|
long px = (long)(x + 30_000_000) & 0x3FFFFFF;
|
|
|
|
|
long pz = (long)(z + 30_000_000) & 0x3FFFFFF;
|
|
|
|
|
long py = (long)(y + 2048) & 0xFFF;
|
|
|
|
|
return (px << 38) | (pz << 12) | py;
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|