mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
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
39 lines
951 B
C#
39 lines
951 B
C#
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;
|
|
|
|
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)
|
|
{
|
|
return ((long)(x + 30_000_000) << 36)
|
|
| ((long)(z + 30_000_000) << 12)
|
|
| (long)((y + 64) & 0xFFF);
|
|
}
|
|
}
|
|
}
|