pathing: async replan + template success/failure alignment

Move PathSegmentManager's Replan to Task.Run so the main tick only reads
results and swaps executors, and introduce a _nextExecutor pre-planning
slot so upcoming segments can prepare while the current one finishes.

Relax per-tick yaw/pitch rate limiting: allow instantaneous snapping
before jump ticks (Baritone does this and servers do not kick for it).

Align jump-template success/failure contracts with Baritone:
- Success key shifts from "speed squared" to "feet-on-target block".
- Failure window widened to the ~200 tick range.
- AscendTemplate gets a headBonkClear + edge/side proximity
  precondition so launches only happen from a safe takeoff.

Expose an initialMomentumTicks option on TemplateSimulationRunner so
follow-up sidewall scenarios can warm up physics before a template
starts.

Made-with: Cursor
This commit is contained in:
BruceChen 2026-04-19 17:02:41 +00:00
parent e23037a897
commit 95b20d9d1c
6 changed files with 554 additions and 48 deletions

View file

@ -6,9 +6,9 @@ namespace MinecraftClient.Tests.Pathing.Execution;
internal static class TemplateSimulationRunner
{
internal static PlayerPhysics CreateGroundedPhysics(Location start, float yaw)
internal static PlayerPhysics CreateGroundedPhysics(Location start, float yaw, int initialMomentumTicks = 0)
{
return new PlayerPhysics
var physics = new PlayerPhysics
{
Position = new Vec3d(start.X, start.Y, start.Z),
DeltaMovement = Vec3d.Zero,
@ -17,6 +17,11 @@ internal static class TemplateSimulationRunner
Yaw = yaw,
Pitch = 0f
};
if (initialMomentumTicks > 0)
ApplyInitialGroundMomentum(physics, initialMomentumTicks);
return physics;
}
internal static TemplateState Run(IActionTemplate template, PlayerPhysics physics, World world, int maxTicks, out Location finalPos)
@ -39,4 +44,32 @@ internal static class TemplateSimulationRunner
finalPos = new Location(physics.Position.X, physics.Position.Y, physics.Position.Z);
return state;
}
private static void ApplyInitialGroundMomentum(PlayerPhysics physics, int ticks)
{
World world = FlatWorldTestBuilder.CreateStoneFloor();
var seeded = new PlayerPhysics
{
Position = new Vec3d(0.5, 80, 0.5),
DeltaMovement = Vec3d.Zero,
OnGround = true,
MovementSpeed = physics.MovementSpeed,
Yaw = physics.Yaw,
Pitch = physics.Pitch
};
var input = new MovementInput
{
Forward = true,
Sprint = true
};
for (int tick = 0; tick < ticks; tick++)
{
seeded.ApplyInput(input);
seeded.Tick(world);
}
physics.DeltaMovement = seeded.DeltaMovement;
physics.Sprinting = true;
}
}