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
2026-04-11 14:45:54 +08:00
|
|
|
using MinecraftClient.Mapping;
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
using MinecraftClient.Pathing.Core;
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Pathing.Moves.Impl
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Walk off a ledge and drop 1-N blocks in a cardinal direction.
|
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
2026-04-11 14:45:54 +08:00
|
|
|
/// For short drops (1-MaxFallHeight), uses simple scan.
|
|
|
|
|
/// For longer drops, delegates to DynamicFallCost which supports:
|
|
|
|
|
/// - Water/liquid safe landing
|
|
|
|
|
/// - Mid-fall ladder/vine grabbing (resets effective fall height if ≤ 11 blocks)
|
|
|
|
|
/// Based on Baritone's MovementDescend.dynamicFallCost design.
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
/// </summary>
|
|
|
|
|
public sealed class MoveDescend : IMove
|
|
|
|
|
{
|
|
|
|
|
public MoveType Type => MoveType.Descend;
|
|
|
|
|
public int XOffset { get; }
|
|
|
|
|
public int ZOffset { get; }
|
|
|
|
|
public bool DynamicY => true;
|
|
|
|
|
|
|
|
|
|
public MoveDescend(int xOffset, int zOffset)
|
|
|
|
|
{
|
|
|
|
|
XOffset = xOffset;
|
|
|
|
|
ZOffset = zOffset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Calculate(CalculationContext ctx, int x, int y, int z, ref MoveResult result)
|
|
|
|
|
{
|
|
|
|
|
int destX = x + XOffset;
|
|
|
|
|
int destZ = z + ZOffset;
|
|
|
|
|
|
|
|
|
|
if (!ctx.CanWalkThrough(destX, y, destZ) || !ctx.CanWalkThrough(destX, y + 1, destZ))
|
|
|
|
|
{
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
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
2026-04-11 14:45:54 +08:00
|
|
|
// Don't descend from ladder/vine (unreliable)
|
|
|
|
|
Material fromDown = ctx.GetMaterial(x, y - 1, z);
|
|
|
|
|
if (fromDown.CanBeClimbedOn())
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08: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
2026-04-11 14:45:54 +08:00
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for simple 1-block descend first (most common case)
|
|
|
|
|
if (ctx.CanWalkOn(destX, y - 2, destZ))
|
|
|
|
|
{
|
|
|
|
|
Material landOn = ctx.GetMaterial(destX, y - 2, destZ);
|
|
|
|
|
if (MoveHelper.IsHazardous(landOn))
|
|
|
|
|
{
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (ctx.GetMaterial(destX, y - 1, destZ).CanBeClimbedOn())
|
|
|
|
|
{
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double cost = ActionCosts.WalkOffBlock + ActionCosts.FallCost(1);
|
|
|
|
|
result.Set(destX, y - 1, destZ, cost);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Not a simple 1-block drop, try dynamic fall
|
|
|
|
|
DynamicFallCost(ctx, x, y, z, destX, destZ, ref result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Scan downward for a safe landing, supporting water, ladder grabs, and
|
|
|
|
|
/// configurable max heights. Based on Baritone's dynamicFallCost.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static void DynamicFallCost(
|
|
|
|
|
CalculationContext ctx, int x, int y, int z,
|
|
|
|
|
int destX, int destZ, ref MoveResult result)
|
|
|
|
|
{
|
|
|
|
|
if (!ctx.CanWalkThrough(destX, y - 2, destZ))
|
|
|
|
|
{
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double costSoFar = 0;
|
|
|
|
|
int effectiveStartHeight = y;
|
|
|
|
|
|
|
|
|
|
// Scan starts from fallHeight=3 (2 blocks below the ledge)
|
|
|
|
|
// because fallHeight=1 and =2 were already checked above
|
|
|
|
|
int maxScan = ctx.MaxFallHeightWater > ctx.MaxFallHeight
|
|
|
|
|
? ctx.MaxFallHeightWater
|
|
|
|
|
: ctx.MaxFallHeight;
|
|
|
|
|
|
|
|
|
|
for (int fallHeight = 3; fallHeight <= maxScan; fallHeight++)
|
|
|
|
|
{
|
|
|
|
|
int newY = y - fallHeight;
|
|
|
|
|
if (newY < -64) break;
|
|
|
|
|
|
|
|
|
|
Material ontoMat = ctx.GetMaterial(destX, newY, destZ);
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08: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
2026-04-11 14:45:54 +08:00
|
|
|
int unprotectedFallHeight = fallHeight - (y - effectiveStartHeight);
|
|
|
|
|
double tentativeCost = ActionCosts.WalkOffBlock
|
|
|
|
|
+ ActionCosts.FallCost(unprotectedFallHeight) + costSoFar;
|
|
|
|
|
|
|
|
|
|
// Water landing: safe regardless of height (water absorbs all fall damage)
|
|
|
|
|
if (MoveHelper.IsWater(ontoMat))
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08: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
2026-04-11 14:45:54 +08:00
|
|
|
result.Set(destX, newY, destZ, tentativeCost);
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
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
2026-04-11 14:45:54 +08:00
|
|
|
// Mid-fall ladder/vine grab: resets effective fall height.
|
|
|
|
|
// Vanilla: player grabs ladders/vines if falling speed is low enough
|
|
|
|
|
// (roughly ≤ 11 blocks of unprotected free fall).
|
|
|
|
|
if (ctx.AllowLadderGrabDuringFall && unprotectedFallHeight <= 11
|
|
|
|
|
&& ontoMat.CanBeClimbedOn())
|
|
|
|
|
{
|
|
|
|
|
costSoFar += ActionCosts.FallCost(unprotectedFallHeight - 1);
|
|
|
|
|
costSoFar += ActionCosts.LadderDownOne;
|
|
|
|
|
effectiveStartHeight = newY;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Air or passable: continue falling
|
|
|
|
|
if (ctx.CanWalkThrough(destX, newY, destZ))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
// Hit something solid
|
|
|
|
|
if (MoveHelper.IsHazardous(ontoMat))
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
{
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
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
2026-04-11 14:45:54 +08:00
|
|
|
|
|
|
|
|
if (!ctx.CanWalkOn(destX, newY, destZ))
|
|
|
|
|
{
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Solid landing: allowed if within safe fall height
|
|
|
|
|
if (unprotectedFallHeight <= ctx.MaxFallHeight + 1)
|
|
|
|
|
{
|
|
|
|
|
result.Set(destX, newY + 1, destZ, tentativeCost);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
return;
|
feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder
Made-with: Cursor
2026-04-11 01:48:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.SetImpossible();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|