mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Add path execution telemetry and scenario runner
This commit is contained in:
parent
9fe376a3bb
commit
b9bff02107
8 changed files with 215 additions and 4 deletions
|
|
@ -0,0 +1,33 @@
|
|||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.Pathing.Core;
|
||||
using MinecraftClient.Pathing.Execution;
|
||||
using MinecraftClient.Pathing.Execution.Telemetry;
|
||||
|
||||
namespace MinecraftClient.Tests.Pathing.Execution;
|
||||
|
||||
internal sealed record PathSegmentRun(int SegmentIndex, MoveType MoveType, int ElapsedTicks, Location Position);
|
||||
|
||||
internal sealed class RecordingPathExecutionObserver : IPathExecutionObserver
|
||||
{
|
||||
internal List<PathSegmentRun> SegmentRuns { get; } = [];
|
||||
internal int ReplanCount { get; private set; }
|
||||
internal int TotalTicks { get; private set; }
|
||||
|
||||
public void OnNavigationStarted(IReadOnlyList<PathSegment> segments) { }
|
||||
|
||||
public void OnSegmentStarted(int segmentIndex, int totalSegments, PathSegment segment) { }
|
||||
|
||||
public void OnSegmentCompleted(int segmentIndex, int totalSegments, PathSegment segment, int elapsedTicks, Location position)
|
||||
=> SegmentRuns.Add(new PathSegmentRun(segmentIndex, segment.MoveType, elapsedTicks, position));
|
||||
|
||||
public void OnSegmentFailed(int segmentIndex, int totalSegments, PathSegment segment, int elapsedTicks, Location position)
|
||||
=> SegmentRuns.Add(new PathSegmentRun(segmentIndex, segment.MoveType, elapsedTicks, position));
|
||||
|
||||
public void OnNavigationCompleted(int totalTicks) => TotalTicks = totalTicks;
|
||||
|
||||
public void OnReplanStarted(int replanCount, Location position) => ReplanCount = replanCount;
|
||||
|
||||
public void OnReplanSucceeded(int replanCount, IReadOnlyList<PathSegment> segments) { }
|
||||
|
||||
public void OnReplanFailed(int replanCount, Location position) { }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue