mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
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
31 lines
955 B
C#
31 lines
955 B
C#
using System;
|
|
using MinecraftClient.Mapping;
|
|
|
|
namespace MinecraftClient.Pathing.Execution.Templates
|
|
{
|
|
internal static class TemplateHelper
|
|
{
|
|
internal static float CalculateYaw(double dx, double dz)
|
|
{
|
|
float yaw = (float)(-Math.Atan2(dx, dz) / Math.PI * 180.0);
|
|
if (yaw < 0) yaw += 360;
|
|
return yaw;
|
|
}
|
|
|
|
internal static double HorizontalDistanceSq(Location a, Location b)
|
|
{
|
|
double dx = a.X - b.X;
|
|
double dz = a.Z - b.Z;
|
|
return dx * dx + dz * dz;
|
|
}
|
|
|
|
internal static bool IsNear(Location pos, Location target,
|
|
double horizThresholdSq = 0.25, double vertThreshold = 0.8)
|
|
{
|
|
double dx = target.X - pos.X;
|
|
double dz = target.Z - pos.Z;
|
|
double dy = target.Y - pos.Y;
|
|
return dx * dx + dz * dz < horizThresholdSq && Math.Abs(dy) < vertThreshold;
|
|
}
|
|
}
|
|
}
|