mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
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
94 lines
3 KiB
C#
94 lines
3 KiB
C#
using MinecraftClient.Mapping;
|
|
using MinecraftClient.Pathing.Core;
|
|
|
|
namespace MinecraftClient.Pathing.Moves.Impl
|
|
{
|
|
/// <summary>
|
|
/// Straight-down fall at the current X,Z position.
|
|
/// Supports water landing and mid-fall ladder/vine grabbing.
|
|
/// Used for drops where MoveDescend's 1-block horizontal offset doesn't apply.
|
|
/// </summary>
|
|
public sealed class MoveFall : IMove
|
|
{
|
|
public MoveType Type => MoveType.Fall;
|
|
public int XOffset => 0;
|
|
public int ZOffset => 0;
|
|
public bool DynamicY => true;
|
|
|
|
private readonly int _maxScanDepth;
|
|
|
|
public MoveFall(int maxScanDepth = 256)
|
|
{
|
|
_maxScanDepth = maxScanDepth;
|
|
}
|
|
|
|
public void Calculate(CalculationContext ctx, int x, int y, int z, ref MoveResult result)
|
|
{
|
|
if (!ctx.CanWalkThrough(x, y - 1, z))
|
|
{
|
|
result.SetImpossible();
|
|
return;
|
|
}
|
|
|
|
double costSoFar = 0;
|
|
int effectiveStartHeight = y;
|
|
|
|
for (int fallDist = 1; fallDist <= _maxScanDepth; fallDist++)
|
|
{
|
|
int landY = y - fallDist;
|
|
if (landY < -64) break;
|
|
|
|
Material ontoMat = ctx.GetMaterial(x, landY, z);
|
|
int unprotectedFallHeight = fallDist - (y - effectiveStartHeight);
|
|
|
|
// Water landing: safe regardless of height
|
|
if (MoveHelper.IsWater(ontoMat))
|
|
{
|
|
double waterCost = ActionCosts.FallCost(unprotectedFallHeight) + costSoFar;
|
|
result.Set(x, landY, z, waterCost);
|
|
return;
|
|
}
|
|
|
|
// Mid-fall ladder/vine grab (resets effective fall height)
|
|
if (ctx.AllowLadderGrabDuringFall && unprotectedFallHeight <= 11
|
|
&& ontoMat.CanBeClimbedOn())
|
|
{
|
|
costSoFar += ActionCosts.FallCost(unprotectedFallHeight - 1);
|
|
costSoFar += ActionCosts.LadderDownOne;
|
|
effectiveStartHeight = landY;
|
|
continue;
|
|
}
|
|
|
|
if (ctx.CanWalkThrough(x, landY, z))
|
|
continue;
|
|
|
|
// Hit something solid
|
|
if (!ctx.CanWalkOn(x, landY, z))
|
|
{
|
|
result.SetImpossible();
|
|
return;
|
|
}
|
|
|
|
if (MoveHelper.IsHazardous(ontoMat))
|
|
{
|
|
result.SetImpossible();
|
|
return;
|
|
}
|
|
|
|
// Solid landing within safe height
|
|
if (unprotectedFallHeight <= ctx.MaxFallHeight + 1)
|
|
{
|
|
double cost = ActionCosts.FallCost(unprotectedFallHeight) + costSoFar;
|
|
result.Set(x, landY + 1, z, cost);
|
|
return;
|
|
}
|
|
|
|
// Too high for safe landing
|
|
result.SetImpossible();
|
|
return;
|
|
}
|
|
|
|
result.SetImpossible();
|
|
}
|
|
}
|
|
}
|