From 724880f928a27ab37e006be94cc4437807a4a138 Mon Sep 17 00:00:00 2001 From: BruceChen Date: Sat, 18 Apr 2026 16:14:04 +0000 Subject: [PATCH] fix: propagate parkour profiles through astar --- .../Execution/LivePathingRegressionTests.cs | 14 ++++++++++++++ MinecraftClient/Pathing/Core/AStarPathFinder.cs | 2 ++ 2 files changed, 16 insertions(+) diff --git a/MinecraftClient.Tests/Pathing/Execution/LivePathingRegressionTests.cs b/MinecraftClient.Tests/Pathing/Execution/LivePathingRegressionTests.cs index 62a2eb41..a3c38288 100644 --- a/MinecraftClient.Tests/Pathing/Execution/LivePathingRegressionTests.cs +++ b/MinecraftClient.Tests/Pathing/Execution/LivePathingRegressionTests.cs @@ -132,6 +132,20 @@ public sealed class LivePathingRegressionTests Assert.Equal(scenario.Goal.Z + 0.5, segments[^1].End.Z); } + [Fact] + public void AStar_LinearFlatGapFourChain_TagsParkourSegmentsAsDefaultProfile() + { + PathingExecutionScenario scenario = LinearParkourScenarioBuilder.Create("linear-flat-gap4", gap: 4, deltaY: 0); + PathResult result = PathingScenarioRunner.PlanOnly(scenario); + List segments = PathSegmentBuilder.FromPath(result.Path); + + Assert.Equal(PathStatus.Success, result.Status); + Assert.Equal(3, segments.Count(segment => segment.MoveType == MoveType.Parkour)); + Assert.All( + segments.Where(segment => segment.MoveType == MoveType.Parkour), + segment => Assert.Equal(ParkourProfile.Default, segment.ParkourProfile)); + } + [Theory] [InlineData("linear-ascend-gap2-dy+1", 2, 1)] [InlineData("linear-descend-gap4-dy-1", 4, -1)] diff --git a/MinecraftClient/Pathing/Core/AStarPathFinder.cs b/MinecraftClient/Pathing/Core/AStarPathFinder.cs index d137c552..1b6d9112 100644 --- a/MinecraftClient/Pathing/Core/AStarPathFinder.cs +++ b/MinecraftClient/Pathing/Core/AStarPathFinder.cs @@ -226,6 +226,7 @@ namespace MinecraftClient.Pathing.Core neighbor.GCost = tentativeG; neighbor.Parent = current; neighbor.MoveUsed = move.Type; + neighbor.ParkourProfile = moveResult.ParkourProfile; if (neighbor.IsOpen) openSet.Update(neighbor); } @@ -237,6 +238,7 @@ namespace MinecraftClient.Pathing.Core HCost = goal.Heuristic(nx, ny, nz), Parent = current, MoveUsed = move.Type, + ParkourProfile = moveResult.ParkourProfile, IsOpen = true }; nodeMap[packed] = neighbor;