Minecraft-Console-Client/MinecraftClient
BruceChen f7d9a8048c pathing: fix long-descend water drift and offload PathDiag to background
Two related fixes for the (255,117,220) -> (237,97,172) route reported
where the bot fell out of a 22-block water descent and landed on the
rim, and where /pathdiag noticeably froze and warped the bot.

DescendTemplate: long-fall water-column overshoot
=================================================
On segment 7 of the route, a 22-block descend Descend (254.5,113,224.5)
-> (253.5,91,224.5), the bot's footprint enters the target column at
the very first airborne tick (X=253.6 footprint inside [253,254], Z=224.7
footprint inside [224,225]). The previous code immediately set
biasTowardExitInAir = true, rotating yaw to the next segment's exit
heading (-Z) for the entire 20+ tick fall. Forward held during the
fall pushed -Z momentum each tick (~0.05 m/tick equilibrium), so by
landing time the bot had drifted ~1 m past the water column and landed
on the dry rim (Z=223.42 vs target Z=224.5). On a real server this
plunge from 22 blocks onto a non-water block would kill the bot.

Two changes in DescendTemplate.cs:

1. Gate the footprint-inside-target bias for non-single-step descends
   behind a "near landing" check (remainingFallY <= 1.5 m, ~3 ticks of
   free-fall). The bias still applies on single-step descends (where
   the fall is too short for drift to matter) and on the final approach
   ticks of multi-block falls.

2. Extend the existing riskyOvershoot Back-input brake to fire on any
   multi-block descend whose footprint is already inside the target,
   not just the PrepareJump exit case. Once the bot is in the column,
   the segment's horizontal travel is done; releasing Forward and
   pressing Back kills any residual horizontal velocity so the bot
   falls straight into the water/landing block instead of accumulating
   air-control momentum from holding Forward for 20+ ticks.

Verified on 1.21.11 with /pathdiag on: segment 7 now lands at
(253.59,91,224.42), 0.09 m off target X and 0.08 m off target Z, well
inside the target water column.

PathSegmentManager: PathDiag main-thread offload
=================================================
Diagnostic dumps were emitted line-by-line through _infoLog?.Invoke(),
which calls Log.Info -> ConsoleIO.WriteLogLine -> file logger on the
main 20 TPS tick. A slow-segment dump or failure trace produces
25-200 synchronous log calls; on the affected route a single batch
took 200-500 ms on the tick thread, freezing the position-packet
stream long enough for the server to lose track and then snap the
bot forward when the tick resumed. Symptom on the user side: every
time /pathdiag is on, the bot freezes for ~half a second, then
"teleports" through the queued segments, then freezes again.

Each diagnostic emission point now snapshots its lines into a List
and dispatches them through DispatchDiagnosticsBatch, which appends
to a single chained Task running on TaskScheduler.Default. The chain
preserves emission order across batches so concurrent slow-segment
and seg-> headers do not interleave. The tick path now does O(1)
work per dump (build list, ContinueWith) instead of O(N) console
writes.

Verified by running the same /goto twice (with and without pathdiag):
both runs produced identical trajectories and identical replan
counts, confirming the diagnostics path no longer perturbs movement.

Pathing test suite: 23 failures, identical to baseline. Live regression
on prior 4 zero-replan routes ((237<->252, 237<->244)) all still
complete cleanly.

Made-with: Cursor
2026-04-29 13:44:26 +00:00
..
ChatBots Add TUI support for /map 2026-04-05 17:41:32 +08:00
CommandHandler Modernize data carriers to records and add primary constructors 2026-03-24 01:31:17 +00:00
Commands pathing: stabilize 0-replan round-trip on ledge/descend runs 2026-04-22 16:43:43 +00:00
config Optimized World.cs 2026-03-25 23:57:02 +01:00
Crypto Fix warnings 2026-04-06 20:36:12 +08:00
Inventory Enhance container handling for Minecraft protocol updates 2026-03-28 02:17:47 +08:00
Logger refactor: convert == null / != null to is null / is not null in 31 files 2026-03-24 00:42:59 +00:00
Mapping Merge remote-tracking branch 'origin/master' into feat/optimization 2026-04-03 15:44:59 +02:00
Mcp Bugfixes to the Looking and Movement. Added General prompt engineer. 2026-04-03 19:54:26 +02:00
Pathing pathing: fix long-descend water drift and offload PathDiag to background 2026-04-29 13:44:26 +00:00
Physics pathing: tighten linear parkour execution 2026-04-18 06:14:45 +00:00
Properties Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
Protocol fix: correct scoreboard packet parsing for UpdateScore and ScoreboardObjective 2026-04-09 17:15:55 +08:00
Proxy Tooltip support & Bug fix 2022-12-11 13:00:19 +08:00
Resources pathing: stabilize 0-replan round-trip on ledge/descend runs 2026-04-22 16:43:43 +00:00
Scripting feat: complete Phase 4 McClient integration for A* pathfinding 2026-04-12 18:43:32 +00:00
TabList Added a /tab command 2026-04-04 16:17:49 +02:00
Tui fix: update GitHub link in MccBannerPanelBuilder 2026-04-06 20:36:12 +08:00
WinAPI Fix warnings 2026-04-06 20:36:12 +08:00
Achievement.cs Implement unified achievements feature: data model, protocol handling, state management, ChatBot API, and /achievement command 2026-03-29 20:22:31 +00:00
AutoTimeout.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
ClassicConsoleBackend.cs refactor: simplify color handling in ClassicConsoleBackend 2026-04-08 02:05:26 +08:00
ColorHelper.cs refactor: simplify color handling in ClassicConsoleBackend 2026-04-08 02:05:26 +08:00
Command.cs Bug fix 2022-12-11 16:30:45 +08:00
ConsoleIO.cs Refactor ConsoleIO and Program settings handling 2026-03-29 00:54:34 +08:00
ExtensionMethods.cs Better translation 2022-10-17 20:00:33 +08:00
FileMonitor.cs refactor: convert == null / != null to is null / is not null in 31 files 2026-03-24 00:42:59 +00:00
IConsoleBackend.cs TUI for MCC (#2976) 2026-03-26 02:08:18 +08:00
INIFile.cs [skip ci] Normalize all line endings 2023-09-15 14:44:11 +08:00
Json.cs Fixed a JSON exception 2026-03-26 19:16:48 +01:00
LegacyAchievementCatalog.cs Fix legacy achievements and add test harness 2026-03-30 17:25:08 +02:00
McClient.cs pathing: stabilize 0-replan round-trip on ledge/descend runs 2026-04-22 16:43:43 +00:00
MinecraftClient.csproj chore: update ModelContextProtocol package version to 1.2.0 and adjust Consolonia and Sentry package versions 2026-04-12 18:46:57 +08:00
Program.cs refactor: simplify color handling in ClassicConsoleBackend 2026-04-08 02:05:26 +08:00
RecipeBookRecipeEntry.cs fix: support 1.21.11 recipe book display ids 2026-03-29 18:45:14 +00:00
Settings.cs feat: enhance game language support in settings 2026-04-07 02:03:02 +08:00
TaskWithDelay.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
TaskWithResult.cs Modernize null-check patterns: use 'is null' and 'is not null' 2026-03-24 00:28:02 +00:00
UpgradeHelper.cs Modernize null-check patterns: use 'is null' and 'is not null' 2026-03-24 00:28:02 +00:00