Minecraft-Console-Client/MinecraftClient/Pathing/Core/PathNode.cs
BruceChen 1abab20f17 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-12 18:43:32 +00:00

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);
}
}
}