From fb30886756e1604f902b60313e8120afe1776a05 Mon Sep 17 00:00:00 2001 From: BruceChen Date: Sun, 12 Apr 2026 00:23:01 +0800 Subject: [PATCH] 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 --- .../Pathing/Execution/Templates/WalkTemplate.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MinecraftClient/Pathing/Execution/Templates/WalkTemplate.cs b/MinecraftClient/Pathing/Execution/Templates/WalkTemplate.cs index 8711d4b5..fd3a4063 100644 --- a/MinecraftClient/Pathing/Execution/Templates/WalkTemplate.cs +++ b/MinecraftClient/Pathing/Execution/Templates/WalkTemplate.cs @@ -32,16 +32,27 @@ namespace MinecraftClient.Pathing.Execution.Templates double dz = ExpectedEnd.Z - pos.Z; physics.Yaw = TemplateHelper.CalculateYaw(dx, dz); input.Forward = true; - input.Sprint = true; + + if (physics.OnClimbable) + { + input.Jump = true; + input.Sprint = false; + } + else + { + input.Sprint = true; + } if (TemplateHelper.IsNear(pos, ExpectedEnd, horizThresholdSq: 0.20)) return TemplateState.Complete; double movedSq = TemplateHelper.HorizontalDistanceSq(pos, _lastPos); + int stuckThreshold = physics.OnClimbable ? 80 : 40; _stuckTicks = movedSq < 0.0005 ? _stuckTicks + 1 : 0; _lastPos = pos; - if (_stuckTicks > 40 || _tickCount > 100) + int tickLimit = physics.OnClimbable ? 160 : 100; + if (_stuckTicks > stuckThreshold || _tickCount > tickLimit) return TemplateState.Failed; return TemplateState.InProgress;