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
28 lines
625 B
C#
28 lines
625 B
C#
using System;
|
|
|
|
namespace MinecraftClient.Pathing.Goals
|
|
{
|
|
public sealed class GoalXZ : IGoal
|
|
{
|
|
public int X { get; }
|
|
public int Z { get; }
|
|
|
|
public GoalXZ(int x, int z)
|
|
{
|
|
X = x;
|
|
Z = z;
|
|
}
|
|
|
|
public bool IsInGoal(int x, int y, int z)
|
|
=> x == X && z == Z;
|
|
|
|
public double Heuristic(int x, int y, int z)
|
|
{
|
|
int dx = Math.Abs(x - X);
|
|
int dz = Math.Abs(z - Z);
|
|
return GoalBlock.DistanceHeuristic(dx, 0, dz);
|
|
}
|
|
|
|
public override string ToString() => $"GoalXZ({X}, {Z})";
|
|
}
|
|
}
|