feat: complete Phase 4 McClient integration for A* pathfinding

- Fix MoveHelper.IsOpenGate: MangroveWood -> MangroveFenceGate
- Fix ResetStateForTransfer to cancel and clear pathSegmentManager
- Fix GetCurrentMovementGoal to return correct goal during A* navigation
- Fix SetMovementSpeed(Sneak) speed value consistency (2 -> 1)
- Migrate /pathfind command to use MoveToAStar + PathSegmentManager
- Add NavigateToGoal(IGoal) to McClient for flexible goal navigation
- Refactor MoveToAStar to delegate to NavigateToGoal
- Add ChatBot API: NavigateTo, CancelMovement, GetCurrentMovementGoal
- Expose PathSegmentManager.Goal property for external goal inspection

Made-with: Cursor
This commit is contained in:
BruceChen 2026-04-12 00:03:43 +08:00
parent 53082d387e
commit 8ece75acc3
5 changed files with 78 additions and 113 deletions

View file

@ -1246,6 +1246,18 @@ namespace MinecraftClient.Scripting
return Handler.MoveTo(location, allowUnsafe, allowDirectTeleport, maxOffset, minOffset, timeout);
}
/// <summary>
/// Navigate to a goal using A* pathfinding with template-based execution.
/// Supports GoalBlock, GoalXZ, GoalNear, GoalComposite for flexible targeting.
/// </summary>
/// <param name="goal">Target goal (GoalBlock, GoalNear, GoalXZ, etc.)</param>
/// <param name="timeoutMs">Maximum pathfinding computation time in milliseconds</param>
/// <returns>Tuple of (success, descriptive message)</returns>
protected (bool success, string message) NavigateTo(Pathing.Goals.IGoal goal, long timeoutMs = 5000)
{
return Handler.NavigateToGoal(goal, timeoutMs);
}
/// <summary>
/// Check if the client is currently processing a Movement.
/// </summary>
@ -1255,6 +1267,24 @@ namespace MinecraftClient.Scripting
return Handler.ClientIsMoving();
}
/// <summary>
/// Cancel the current movement, stopping both legacy and A* pathfinding.
/// </summary>
/// <returns>true if there was an active movement that was cancelled</returns>
protected bool CancelMovement()
{
return Handler.CancelMovement();
}
/// <summary>
/// Get the current movement goal location.
/// Returns Location.Zero if no movement is active.
/// </summary>
protected Location GetCurrentMovementGoal()
{
return Handler.GetCurrentMovementGoal();
}
/// <summary>
/// Look at the specified location
/// </summary>