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
73 lines
2.6 KiB
C#
73 lines
2.6 KiB
C#
using MinecraftClient.Mapping;
|
|
using MinecraftClient.Pathing.Moves;
|
|
|
|
namespace MinecraftClient.Pathing.Core
|
|
{
|
|
/// <summary>
|
|
/// Thread-safe snapshot of world state and player capabilities for path planning.
|
|
/// Created once at the start of a search; all move calculations read from this.
|
|
/// </summary>
|
|
public sealed class CalculationContext
|
|
{
|
|
public World World { get; }
|
|
public bool CanSprint { get; }
|
|
public bool AllowParkour { get; }
|
|
public bool AllowParkourAscend { get; }
|
|
public bool AllowDiagonalDescend { get; }
|
|
public int MaxFallHeight { get; }
|
|
public int MaxFallHeightWater { get; }
|
|
public bool AllowLadderGrabDuringFall { get; }
|
|
public double JumpPenalty { get; }
|
|
public double WalkCost { get; }
|
|
public double SprintCost { get; }
|
|
public double SneakCost { get; }
|
|
|
|
public CalculationContext(
|
|
World world,
|
|
bool canSprint = true,
|
|
bool allowParkour = false,
|
|
bool allowParkourAscend = false,
|
|
bool allowDiagonalDescend = true,
|
|
int maxFallHeight = 3,
|
|
int maxFallHeightWater = 256,
|
|
bool allowLadderGrabDuringFall = true,
|
|
double jumpPenalty = ActionCosts.JumpPenalty)
|
|
{
|
|
World = world;
|
|
CanSprint = canSprint;
|
|
AllowParkour = allowParkour;
|
|
AllowParkourAscend = allowParkourAscend;
|
|
AllowDiagonalDescend = allowDiagonalDescend;
|
|
MaxFallHeight = maxFallHeight;
|
|
MaxFallHeightWater = maxFallHeightWater;
|
|
AllowLadderGrabDuringFall = allowLadderGrabDuringFall;
|
|
JumpPenalty = jumpPenalty;
|
|
WalkCost = ActionCosts.WalkOneBlock;
|
|
SprintCost = CanSprint ? ActionCosts.SprintOneBlock : ActionCosts.WalkOneBlock;
|
|
SneakCost = ActionCosts.SneakOneBlock;
|
|
}
|
|
|
|
public Block GetBlock(int x, int y, int z)
|
|
=> World.GetBlock(new Location(x, y, z));
|
|
|
|
public Material GetMaterial(int x, int y, int z)
|
|
=> GetBlock(x, y, z).Type;
|
|
|
|
public bool CanWalkThrough(int x, int y, int z)
|
|
=> MoveHelper.CanWalkThrough(this, x, y, z);
|
|
|
|
public bool CanWalkOn(int x, int y, int z)
|
|
=> MoveHelper.CanWalkOn(this, x, y, z);
|
|
|
|
public bool IsFullyPassable(int x, int y, int z)
|
|
=> MoveHelper.IsFullyPassable(this, x, y, z);
|
|
|
|
public bool IsChunkLoaded(int x, int z)
|
|
{
|
|
int cx = x >> 4;
|
|
int cz = z >> 4;
|
|
var col = World[cx, cz];
|
|
return col is not null && col.FullyLoaded;
|
|
}
|
|
}
|
|
}
|