[PR #4394] [CLOSED] Mining: a jump's misses keep the break state (MC-69865) #5600

Closed
opened 2026-11-03 05:13:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4394
Author: @WhyFovius
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: fix/jump-mining-progress


📝 Commits (1)

  • c926630 Mining: a jump's misses keep the break state (MC-69865)

📊 Changes

3 files changed (+323 additions, -102 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+26 -3)
📝 crates/horizon-client/src/game/remote.rs (+253 -97)
📝 tests/test_remote_mining.py (+44 -2)

📄 Description

🤖 Opened by WhyFovius's AI agent (Claude), not by WhyFovius personally.

Fixes #4124.

The bug. Holding the attack button while jumping at a block too high to reach resets its breaking progress on every fall, so the block never breaks. Vanilla Java keeps it (MC-69865, listed in the speedrunning rules as "Maintaining block breaking status after losing focus") — the reporter calls it "part of many people's daily gameplay".

Why vanilla keeps it (read off the 26.3 bytecode, MultiPlayerGameMode / ServerPlayerGameMode):

  • stopDestroyBlock is a no-op unless a dig is running (isDestroying), and even then it clears only the progress and the crack — destroyBlockPos and destroyingItem survive, so sameDestroyTarget still matches once the block is in reach again.
  • continueDestroyBlock's same-target branch accumulates the progress and never sends a second START; it does not re-arm isDestroying either, so every stopDestroyBlock after the first fall is the no-op above. The first miss aborts once; the rest keep the state.
  • On the server, abortDestroyBlock clears isDestroyingBlock but leaves destroyPos and destroyProgressStart, and the STOP case has no isDestroyingBlock guard: it matches the kept destroyPos and counts gameTicks - destroyProgressStart + 1 — from the START before the misses. The wall clock through the jumps is what makes the block break at the STOP.

The divergence. The local (--in-frame) path already models this (first_person::Destroying with its active gate). The remote path — the server-thread single player, LAN guests, dedicated servers — re-implements the machine in game/remote.rs without an isDestroying: every miss called stop_remote_mining unconditionally, erasing the target, the progress and the crack, and the server's ABORT handler dropped play.digging entirely, so a later STOP matched nothing and the dig restarted with every jump.

The fix mirrors vanilla on both sides of the wire:

  • game/remote.rs: Remote::is_destroying beside the target; stop_destroy/destroy_route encode stopDestroyBlock's gate and the startDestroyBlock/continueDestroyBlock routing (a held attack continues the target without a second START, a click restarts a stopped dig, a new target aborts a running one); continueAttack's air branch is the no-op vanilla's is. Minecraft.startUseItem's isDestroying gate now reads the flag instead of the target.
  • game/lan_actions.rs: the ABORT handler keeps the block and its dig_start (abortDestroyBlock keeps destroyPos and destroyProgressStart); the dig is simulated only while it runs (isDestroyingBlock), so tick_mining and the crack broadcasts stop at the abort exactly as vanilla's tick() does, while a STOP still matches the kept dig and counts from the original START.

Unit tests pin the state rules (a_stop_without_a_running_dig_keeps_the_break_state, a_held_attack_continues_a_stopped_dig_without_a_new_start). The vanilla sequence end to end: first fall aborts once (server clears the crack), following falls keep the state (the digger's crack stays), and the final STOP's wall-clock progress breaks the block.

pr_ready (tools/pr_ready.py --quick on Windows, against origin/main at 0a341cc35, 52 s)

Check Result
Scope ✅ 3 files, +323 −102
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (39 s)
rustfmt ✅ (6 s)
clippy ✅
tests: horizon-client ❌ 731 passed, 1 failed (3 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The one failing test, title::tests::each_world_preset_writes_its_own_generator, is pre-existing on this machine: it fails on clean origin/main too (os error 267, a Windows temp-directory quirk in the test itself), unrelated to this change.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4394 **Author:** [@WhyFovius](https://github.com/WhyFovius) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/jump-mining-progress` --- ### 📝 Commits (1) - [`c926630`](https://github.com/horizon-rust/horizon/commit/c926630b6bdffc56016cf6f1512fa59eceeb45b9) Mining: a jump's misses keep the break state (MC-69865) ### 📊 Changes **3 files changed** (+323 additions, -102 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+26 -3) 📝 `crates/horizon-client/src/game/remote.rs` (+253 -97) 📝 `tests/test_remote_mining.py` (+44 -2) </details> ### 📄 Description > 🤖 Opened by WhyFovius's AI agent (Claude), not by WhyFovius personally. Fixes #4124. **The bug.** Holding the attack button while jumping at a block too high to reach resets its breaking progress on every fall, so the block never breaks. Vanilla Java keeps it (MC-69865, listed in the speedrunning rules as "Maintaining block breaking status after losing focus") — the reporter calls it "part of many people's daily gameplay". **Why vanilla keeps it** (read off the 26.3 bytecode, `MultiPlayerGameMode` / `ServerPlayerGameMode`): - `stopDestroyBlock` is a **no-op unless a dig is running** (`isDestroying`), and even then it clears only the progress and the crack — `destroyBlockPos` and `destroyingItem` survive, so `sameDestroyTarget` still matches once the block is in reach again. - `continueDestroyBlock`'s same-target branch accumulates the progress and **never sends a second START**; it does not re-arm `isDestroying` either, so every `stopDestroyBlock` after the first fall is the no-op above. The first miss aborts once; the rest keep the state. - On the server, `abortDestroyBlock` clears `isDestroyingBlock` but leaves `destroyPos` and `destroyProgressStart`, and the STOP case has no `isDestroyingBlock` guard: it matches the kept `destroyPos` and counts `gameTicks - destroyProgressStart + 1` — from the START before the misses. The wall clock through the jumps is what makes the block break at the STOP. **The divergence.** The local (`--in-frame`) path already models this (`first_person::Destroying` with its `active` gate). The remote path — the server-thread single player, LAN guests, dedicated servers — re-implements the machine in `game/remote.rs` without an `isDestroying`: every miss called `stop_remote_mining` unconditionally, erasing the target, the progress and the crack, and the server's ABORT handler dropped `play.digging` entirely, so a later STOP matched nothing and the dig restarted with every jump. **The fix** mirrors vanilla on both sides of the wire: - `game/remote.rs`: `Remote::is_destroying` beside the target; `stop_destroy`/`destroy_route` encode `stopDestroyBlock`'s gate and the `startDestroyBlock`/`continueDestroyBlock` routing (a held attack continues the target without a second START, a click restarts a stopped dig, a new target aborts a running one); `continueAttack`'s air branch is the no-op vanilla's is. `Minecraft.startUseItem`'s `isDestroying` gate now reads the flag instead of the target. - `game/lan_actions.rs`: the ABORT handler keeps the block and its `dig_start` (`abortDestroyBlock` keeps `destroyPos` and `destroyProgressStart`); the dig is simulated only while it runs (`isDestroyingBlock`), so `tick_mining` and the crack broadcasts stop at the abort exactly as vanilla's `tick()` does, while a STOP still matches the kept dig and counts from the original START. Unit tests pin the state rules (`a_stop_without_a_running_dig_keeps_the_break_state`, `a_held_attack_continues_a_stopped_dig_without_a_new_start`). The vanilla sequence end to end: first fall aborts once (server clears the crack), following falls keep the state (the digger's crack stays), and the final STOP's wall-clock progress breaks the block. **pr_ready** (`tools/pr_ready.py --quick` on Windows, against origin/main at 0a341cc35, 52 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +323 −102 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (39 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ | | tests: horizon-client | ❌ 731 passed, 1 failed (3 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The one failing test, `title::tests::each_world_preset_writes_its_own_generator`, is pre-existing on this machine: it fails on clean `origin/main` too (os error 267, a Windows temp-directory quirk in the test itself), unrelated to this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5600
No description provided.