Commit graph

11 commits

Author SHA1 Message Date
BruceChen
fb30886756 fix: handle climbable blocks in WalkTemplate to prevent stuck on ladders
WalkTemplate now detects when physics.OnClimbable is true (player entering
a ladder/vine block) and switches from Sprint to Jump input, with extended
stuck detection thresholds. This prevents the template from failing when
the path walks through climbable blocks.

Tested on 1.21.11: all movement types pass (walk, diagonal, ascend, descend,
climb, parkour 2-4 gap, mixed courses with direction changes).

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
8ece75acc3 feat: complete Phase 4 McClient integration for A* pathfinding
- Fix MoveHelper.IsOpenGate: MangroveWood -> MangroveFenceGate
- Fix ResetStateForTransfer to cancel and clear pathSegmentManager
- Fix GetCurrentMovementGoal to return correct goal during A* navigation
- Fix SetMovementSpeed(Sneak) speed value consistency (2 -> 1)
- Migrate /pathfind command to use MoveToAStar + PathSegmentManager
- Add NavigateToGoal(IGoal) to McClient for flexible goal navigation
- Refactor MoveToAStar to delegate to NavigateToGoal
- Add ChatBot API: NavigateTo, CancelMovement, GetCurrentMovementGoal
- Expose PathSegmentManager.Goal property for external goal inspection

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
53082d387e 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-12 18:43:32 +00:00
BruceChen
a9c9a6a669 fix: set movement input before completion check to maintain sprint momentum
Templates now set Forward/Sprint input before checking completion
conditions. This prevents a 1-tick input gap during template transitions
that caused the player to lose sprint speed, making parkour jumps fail
due to insufficient horizontal velocity.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
034c5d0cab fix: correct collision axis ordering and step-up threshold to match vanilla
Two bugs in CollisionDetector caused persistent Y-axis bouncing (0.6 block
oscillation) while walking on flat ground:

1. GetAxisStepOrder used a complex 6-branch sorting that often placed
   horizontal axes before Y. Vanilla's Direction.Axis.axisStepOrder always
   resolves Y first, then the larger horizontal axis. Replaced with the
   simple two-case vanilla logic.

2. The horizontal-blocked checks (blockedX/blockedZ) used exact != which
   triggered on floating-point noise (~1e-15) from sin/cos in movement
   input. Vanilla uses Mth.equal (1e-5 threshold). This false positive
   caused step-up to fire every few ticks on flat terrain.

Also includes DescendTemplate robustness fixes from the previous session
(fail on unintended climbing, suppress forward input on climbable blocks).

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
4b49135107 feat: add parkour moves and template-based path execution system
Phase 2.2: MoveParkour for sprint-jump across 1-2 block gaps (distance 2-3)
and ascending parkour (distance 2, +1Y). Registered in BuildDefaultMoves
with CalculationContext.AllowParkour gating.

Phase 3.1-3.2: Template execution engine replacing the waypoint queue system.
- IActionTemplate interface with per-tick state machine pattern
- Templates: Walk, Ascend, Descend, Climb, Fall, SprintJump
- ActionTemplateFactory maps MoveType to the correct template
- PathExecutor drives sequential template execution with logging
- PathSegmentManager handles replanning on failure (up to 5 retries)
- McClient integration: MoveToAStar now creates PathSegmentManager,
  UpdatePathfindingInput delegates to it, CancelMovement/ClientIsMoving
  updated for both old and new systems.

Tested on 1.21.11: straight walk, zigzag maze, stair ascent,
1-gap and 2-gap sprint jumps all pass.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
a6261e4019 fix: improve pathfinding execution for climbing and block classification
- Fix MoveHelper.CanWalkThrough to treat climbable blocks (ladders, vines)
  as passable, not solid -- MCC's IsSolid() incorrectly classifies them
- Fix MoveHelper.CanWalkOn to exclude climbable blocks from ground check
- Add fence gate passability in MoveHelper
- Fix start position calculation in MoveToAStar to handle solid-block
  floor rounding (player at y=79.9 → floor y=79 inside solid)
- Fix ReachedWaypoint to require vertical proximity for climb waypoints,
  preventing premature waypoint consumption during ladder ascent
- Fix SetInputToward to handle ladder climbing with Jump input and proper
  wall-facing when OnClimbable

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
77c5f88168 feat: add /goto command with A* pathfinder integration and MoveFall
- Add MoveFall move for straight-down falls beyond MoveDescend range
- Register MoveFall in default move set
- Create /goto command using new A* pathfinder
- Add MoveToAStar() method to McClient bridging A* results to existing
  path execution system (Queue<Location> + UpdatePathfindingInput)
- Add translation entries for goto command

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
deb1bc47cc refactor: clean up debug logging in pathfinder and pathfind command
Remove verbose per-node insertion tracking from A*. Keep essential
logging: start, goal reached, partial/failed results. Clean up
pathfind command with exception handling and cleaner output.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
e9b19d3cbb fix: correct PathNode.Pack bit overlap causing hash collisions
The X and Z fields shared bit 36, causing nodes like (1,80,0)
and (0,80,0) to hash to the same value. Fixed by using proper
non-overlapping bit allocation: X in bits 38-63, Z in bits 12-37,
Y in bits 0-11. Added diagnostic logging to pathfind command.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
1abab20f17 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-12 18:43:32 +00:00