mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
feat: add 4-block jumps, diagonal parkour, high-fall water/ladder support
MoveParkour rewritten to support both cardinal and diagonal sprint jumps with unified (xOff, zOff) interface. New capabilities: - 4-block cardinal sprint jumps with edge-approach timing in template - Diagonal parkour: (2,1), (1,2), (2,2), (3,1), (1,3) in all quadrants - Ascending parkour extended to dist=3 (cardinal) - Overshoot safety check after landing destination - Block parkour from climbable starting blocks (vine/ladder) MoveDescend/MoveFall enhanced with Baritone-style dynamic fall scanning: - Water landing: accepts falls of any height into water - Mid-fall ladder/vine grab: resets effective fall height (<=11 blocks) - CalculationContext gains MaxFallHeightWater, AllowLadderGrabDuringFall SprintJumpTemplate gains distance-based approach timing: - Long jumps (>=3.5 blocks): delays jump until 0.5 blocks from center - Medium jumps (>=2.5): 0.35 blocks approach - Landing tolerance scales with jump distance All movements verified on 1.21.11 local server. Made-with: Cursor
This commit is contained in:
parent
a9c9a6a669
commit
53082d387e
9 changed files with 365 additions and 89 deletions
|
|
@ -7,6 +7,7 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
/// <summary>
|
||||
/// Walk off a ledge and drop 1-N blocks to a landing spot.
|
||||
/// Walks toward the destination; gravity handles the fall.
|
||||
/// Supports both solid landings and water landings.
|
||||
/// </summary>
|
||||
public sealed class DescendTemplate : IActionTemplate
|
||||
{
|
||||
|
|
@ -34,24 +35,29 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
if (!physics.OnGround)
|
||||
_hasFallen = true;
|
||||
|
||||
// Completion: landed on ground near destination
|
||||
if (_hasFallen && physics.OnGround && horizDistSq < 0.5 && Math.Abs(dy) < 0.8)
|
||||
return TemplateState.Complete;
|
||||
|
||||
// Completion: already at destination without falling (e.g., single step down)
|
||||
if (horizDistSq < 0.25 && Math.Abs(dy) < 0.5 && physics.OnGround)
|
||||
return TemplateState.Complete;
|
||||
|
||||
// Completion: landed in water near destination
|
||||
if (_hasFallen && physics.InWater && horizDistSq < 0.5 && Math.Abs(dy) < 2.0)
|
||||
return TemplateState.Complete;
|
||||
|
||||
// Fail if climbing up instead of descending
|
||||
if (pos.Y > ExpectedStart.Y + 2.0)
|
||||
return TemplateState.Failed;
|
||||
|
||||
if (_tickCount > 120)
|
||||
if (_tickCount > 200)
|
||||
return TemplateState.Failed;
|
||||
|
||||
if (horizDistSq > 0.01)
|
||||
{
|
||||
physics.Yaw = TemplateHelper.CalculateYaw(dx, dz);
|
||||
input.Forward = true;
|
||||
// Don't push into climbable blocks during descent
|
||||
if (physics.OnClimbable)
|
||||
input.Forward = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
{
|
||||
/// <summary>
|
||||
/// Vertical free fall at the same X,Z. Waits for the player to land at the target Y.
|
||||
/// Supports both solid ground landings and water landings.
|
||||
/// </summary>
|
||||
public sealed class FallTemplate : IActionTemplate
|
||||
{
|
||||
|
|
@ -30,9 +31,14 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
if (!physics.OnGround)
|
||||
_hasFallen = true;
|
||||
|
||||
// Solid ground landing
|
||||
if (_hasFallen && physics.OnGround && Math.Abs(dy) < 1.0)
|
||||
return TemplateState.Complete;
|
||||
|
||||
// Water landing
|
||||
if (_hasFallen && physics.InWater && Math.Abs(dy) < 2.0)
|
||||
return TemplateState.Complete;
|
||||
|
||||
if (_tickCount > 200)
|
||||
return TemplateState.Failed;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
{
|
||||
/// <summary>
|
||||
/// Sprint-jump across a gap. Uses a phase-based state machine:
|
||||
/// Approach -> jump on first available ground tick -> Airborne -> Landing check.
|
||||
/// Approach -> jump when ready -> Airborne -> Landing check.
|
||||
/// For long jumps (>= 3.5 blocks), delays the jump until the player
|
||||
/// has moved toward the edge of the starting block for maximum distance.
|
||||
/// </summary>
|
||||
public sealed class SprintJumpTemplate : IActionTemplate
|
||||
{
|
||||
|
|
@ -15,6 +17,7 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
public Location ExpectedStart { get; }
|
||||
public Location ExpectedEnd { get; }
|
||||
|
||||
private readonly double _horizDist;
|
||||
private int _tickCount;
|
||||
private Phase _phase = Phase.Approach;
|
||||
|
||||
|
|
@ -22,6 +25,9 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
{
|
||||
ExpectedStart = start;
|
||||
ExpectedEnd = end;
|
||||
double dx = end.X - start.X;
|
||||
double dz = end.Z - start.Z;
|
||||
_horizDist = Math.Sqrt(dx * dx + dz * dz);
|
||||
}
|
||||
|
||||
public TemplateState Tick(Location pos, PlayerPhysics physics, MovementInput input)
|
||||
|
|
@ -42,10 +48,27 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
case Phase.Approach:
|
||||
if (physics.OnGround)
|
||||
{
|
||||
input.Jump = true;
|
||||
_phase = Phase.Airborne;
|
||||
double fromStartSq = TemplateHelper.HorizontalDistanceSq(pos, ExpectedStart);
|
||||
|
||||
// For long jumps, delay the jump until the player has sprinted
|
||||
// toward the block edge. Baritone waits until playerFeet is in
|
||||
// the next block (~0.5 blocks from center) for dist >= 4.
|
||||
// For medium jumps (dist 3), wait 0.35 blocks (Baritone: 0.7).
|
||||
double minApproachSq;
|
||||
if (_horizDist >= 3.5)
|
||||
minApproachSq = 0.25; // 0.5 blocks
|
||||
else if (_horizDist >= 2.5)
|
||||
minApproachSq = 0.12; // ~0.35 blocks
|
||||
else
|
||||
minApproachSq = 0.0;
|
||||
|
||||
if (fromStartSq >= minApproachSq)
|
||||
{
|
||||
input.Jump = true;
|
||||
_phase = Phase.Airborne;
|
||||
}
|
||||
}
|
||||
if (_tickCount > 20)
|
||||
if (_tickCount > 30)
|
||||
return TemplateState.Failed;
|
||||
break;
|
||||
|
||||
|
|
@ -56,7 +79,9 @@ namespace MinecraftClient.Pathing.Execution.Templates
|
|||
goto case Phase.Landing;
|
||||
|
||||
case Phase.Landing:
|
||||
if (horizDistSq < 2.0 && Math.Abs(dy) < 1.0)
|
||||
// Tolerance scales with jump distance
|
||||
double horizTolerance = _horizDist >= 3.5 ? 3.0 : 2.0;
|
||||
if (horizDistSq < horizTolerance && Math.Abs(dy) < 1.0)
|
||||
return TemplateState.Complete;
|
||||
return TemplateState.Failed;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue