mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Fix a cluster of execution-layer issues that caused replans and void falls when traversing narrow ledges and multi-block descents between (251.5,141,210.5) and (252.5,138,220.5): - WalkTemplate / GroundedSegmentController: suppress the pre-rotation bias toward the next segment's exit heading on stable-footing Turn exits where the next segment is not a jump. The next template snaps yaw on its first tick anyway, and pre-rotating mid-stride on a 1-block walkway pushes sprint drift perpendicular to the path and walks the bot off the edge. Turn exits into a jump still get the bias so the takeoff direction stays aligned. - GroundedSegmentController.ShouldComplete: relax the headingReady gate for Turn exits with stable footing so the segment can complete once yaw is aligned with either the current or the next segment heading (within 25/15 deg). Without this the removed bias would leave the bot stuck at the end of a walkway waiting for a rotation that never happens. - DescendTemplate: restrict the airborne exit-heading bias so it only kicks in when the footprint is inside the landing block, or on single-step drops where the fall is too short for lateral drift to miss the landing column. On 2+ block drops the bot now keeps yaw pointed at the landing center for the whole fall. - DescendTemplate: add a multi-block overshoot guard on PrepareJump exits. Once airborne and past the landing end-plane on a 2+ Y drop, release forward/sprint and press back briefly so air drag pulls the bot back into the 1x1 landing column instead of sailing one block past it into the neighbouring void. Live round-trip between the two goal coordinates now completes with zero replans in three consecutive runs in each direction. Full unit test suite is unchanged from the pre-existing baseline (22 failing tests, all orthogonal to this change). Made-with: Cursor
57 lines
2.2 KiB
C#
57 lines
2.2 KiB
C#
using Brigadier.NET;
|
|
using Brigadier.NET.Builder;
|
|
using MinecraftClient.CommandHandler;
|
|
using MinecraftClient.Pathing.Execution;
|
|
using static MinecraftClient.CommandHandler.CmdResult;
|
|
|
|
namespace MinecraftClient.Commands
|
|
{
|
|
/// <summary>
|
|
/// Toggles Info-level pathing diagnostics. When enabled, <see cref="PathSegmentManager"/>
|
|
/// emits the full waypoint dump of every planned/replanned path, the recent per-tick
|
|
/// trace at segment-failure time, and the failing segment's target. Used for
|
|
/// reporting pathing bugs without permanently changing the debug log level.
|
|
/// </summary>
|
|
public class PathDiag : Command
|
|
{
|
|
public override string CmdName => "pathdiag";
|
|
public override string CmdUsage => "pathdiag [on|off]";
|
|
public override string CmdDesc => Translations.cmd_pathdiag_desc;
|
|
|
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
|
{
|
|
dispatcher.Register(l => l.Literal("help")
|
|
.Then(l => l.Literal(CmdName)
|
|
.Executes(r => GetUsage(r.Source)))
|
|
);
|
|
|
|
dispatcher.Register(l => l.Literal(CmdName)
|
|
.Executes(r => Toggle(r.Source))
|
|
.Then(l => l.Literal("on")
|
|
.Executes(r => SetDiagnostics(r.Source, true)))
|
|
.Then(l => l.Literal("off")
|
|
.Executes(r => SetDiagnostics(r.Source, false)))
|
|
.Then(l => l.Literal("_help")
|
|
.Executes(r => GetUsage(r.Source))
|
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
|
);
|
|
}
|
|
|
|
private int GetUsage(CmdResult r)
|
|
{
|
|
return r.SetAndReturn(GetCmdDescTranslated());
|
|
}
|
|
|
|
private static int Toggle(CmdResult r)
|
|
{
|
|
return SetDiagnostics(r, !PathSegmentManager.DiagnosticsEnabled);
|
|
}
|
|
|
|
private static int SetDiagnostics(CmdResult r, bool enabled)
|
|
{
|
|
PathSegmentManager.DiagnosticsEnabled = enabled;
|
|
return r.SetAndReturn(Status.Done,
|
|
enabled ? Translations.cmd_pathdiag_enabled : Translations.cmd_pathdiag_disabled);
|
|
}
|
|
}
|
|
}
|