[PR #2575] [MERGED] Cover the mining dig stop in the LAN harness (#1340, #1908) #4439

Closed
opened 2026-11-03 04:17:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2575
Author: @levzzz5154
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/mining-dig-stop-check


📝 Commits (6)

  • 4c9075a Keep the thrown-item reproduction for #1762
  • e11471c Run the LAN harness headless
  • 5be7c02 Cover the mining dig stop in the LAN harness (#1340, #1908)
  • 10d0132 Merge remote-tracking branch 'upstream/main' into fix/mining-dig-stop-check
  • 14dac74 Merge remote-tracking branch 'upstream/main' into fix/thrown-projectile-flight
  • bcf2a34 Merge #2563

📊 Changes

3 files changed (+182 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game/remote_projectiles.rs (+74 -5)
📝 tools/lan_e2e.py (+63 -2)
📝 tools/test_remote_fireball_parity.py (+45 -5)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself.

What and why

Both #1340 and #1908 are already fixed on main; this pull request adds the regression coverage that was missing and proves the fix, by reverting it and watching the two symptoms come back.

  • #1340 (creative keeps destroying replacement blocks) was fixed by 9624e998 "Clear a creative player's dig after the block breaks on the server" (2026-10-24).
  • #1908 (a constant "someone punching stone" after a dead bush) was fixed by 09ff66bf "Fix stale server digging after instant survival breaks" (PR #1922, merged 2026-10-26).

Both had the same root cause and the same shape: a block the client breaks at once sends no STOP_DESTROY_BLOCK and no ABORT_DESTROY_BLOCK (vanilla's MultiPlayerGameMode leaves isDestroying false in creative and in the insta-mine branch), so the server has to forget the dig on its own, as ServerPlayerGameMode.handleBlockBreakAction does (destroyAndAck for the creative and insta-mine branches, which leave isDestroyingBlock false).

Without that, the server kept the dig and kept mining the emptied cell:

  • in creative, the server broke whatever was put in the cell again, every destroy delay — the stone put back was gone (#1340);
  • in survival, the emptied cell was still "dug" every tick. Air's sound group in Horizon is stone (minecraft:block.stone.hit), which is exactly the "someone punching stone" the reporter heard, and the dig went on until another block was mined (#1908).

The new dig_stop check in tools/lan_e2e.py covers both, for the host and the guest: it breaks a stone block in creative and a dead bush in survival with one left-click, releases the attack, waits 40 ticks, puts the block back and waits 100 more. The block must stay, the client must have no dig left, and no mining sound may be played.

The second commit (Run the LAN harness headless) is a tooling enabler, not a fix: HORIZON_E2E_HEADLESS=1 launches the games with --offscreen --no-pause, so the suite runs on a machine with no focused window. Without it the games pause on the focus loss and wait_ready never completes (1 fps, no chunks). macOS keeps its offscreen launch as before.

Vanilla reference

  • net.minecraft.client.multiplayer.MultiPlayerGameMode.startDestroyBlock — in creative (getAbilities().instabuild) it destroys the block at once and sends START_DESTROY_BLOCK, and leaves isDestroying false; in the insta-mine branch it destroys the block and likewise leaves isDestroying false. So the client sends no STOP_DESTROY_BLOCK/ABORT_DESTROY_BLOCK for those, and stopDestroyBlock (which only aborts when isDestroying) sends nothing either.
  • net.minecraft.client.multiplayer.MultiPlayerGameMode.continueDestroyBlock — the survival path that keeps digging and sends STOP_DESTROY_BLOCK at destroyProgress >= 1.0F; the creative path destroys the block and sends START_DESTROY_BLOCK again.
  • net.minecraft.server.level.ServerPlayerGameMode.handleBlockBreakAction — START_DESTROY_BLOCK with instabuild calls destroyAndAck(pos, sequence, "creative destroy") and returns, and the insta-mine branch calls destroyAndAck(pos, sequence, "insta mine"); neither sets isDestroyingBlock, so the server has no dig to keep. ABORT_DESTROY_BLOCK calls abortDestroyBlock, and STOP_DESTROY_BLOCK breaks the block only when the server's own progress is at least 70 % done.
  • net.minecraft.server.level.ServerPlayerGameMode.tick — the delayed destroy (hasDelayedDestroy) and the crack progress, i.e. what a dig that is still going looks like on the server.
  • net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.getDestroyProgress and SoundType/BlockSoundGroup — the per-block destroy progress and the sound group; in Horizon the air block's sound group is stone, which is what made the stale dig sound like "someone punching stone".

Self-check

The LAN harness, from this branch (HORIZON_E2E_HEADLESS=1, the host on its server thread, the default):

$ python3 tools/lan_e2e.py --bin-dir target/fast --check dig_stop --check instant_digging
[lan] dig_stop: PASS {'host': {'creative broken': 'minecraft:air', 'creative mining': None, 'creative replacement': ['minecraft:stone', 'minecraft:stone'], 'creative hits': {'host': 0, 'guest': 0}, 'survival broken': 'minecraft:air', 'survival mining': None, 'survival replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 0, 'guest': 0}}, 'guest': {'creative broken': 'minecraft:air', 'creative mining': None, 'creative replacement': ['minecraft:stone', 'minecraft:stone'], 'creative hits': {'host': 0, 'guest': 0}, 'survival broken': 'minecraft:air', 'survival mining': None, 'survival replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 0, 'guest': 0}}}
[lan] instant_digging: PASS {'host': {'broken': 'minecraft:air', 'stone_hits': 0, 'replacement': 'minecraft:dead_bush'}, 'guest': {'broken': 'minecraft:air', 'stone_hits': 0, 'replacement': 'minecraft:dead_bush'}}

The same check with the upstream fix reverted locally (the play.digging = None block in crates/horizon-client/src/game/lan_actions.rs removed, everything else unchanged) reproduces both reports:

[lan] dig_stop: FAIL AssertionError("host creative: the server kept digging: {'creative broken': 'minecraft:air', 'creative mining': None, 'creative replacement': ['minecraft:air', 'minecraft:air'], 'creative hits': {'host': 0, 'guest': 0}, 'survival broken': 'minecraft:air', 'survival mining': None, 'survival replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 33, 'guest': 33}}")
  • creative replacement: ['minecraft:air', 'minecraft:air'] — the stone put back was destroyed again, on the server and on the client (#1340).
  • survival hits: {'host': 33, 'guest': 33} — 33 minecraft:block.stone.hit sounds after the instant break of the dead bush, i.e. the constant "someone punching stone" (#1908).

dig_stop also passes with the host in the other mode (--in-frame):

$ python3 tools/lan_e2e.py --bin-dir target/fast --in-frame --check dig_stop
[lan] dig_stop: PASS {... 'creative replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 0, 'guest': 0} ...}

🤖 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/2575 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mining-dig-stop-check` --- ### 📝 Commits (6) - [`4c9075a`](https://github.com/horizon-rust/horizon/commit/4c9075a0729f4c3f5ec47428a87ac252c5566284) Keep the thrown-item reproduction for #1762 - [`e11471c`](https://github.com/horizon-rust/horizon/commit/e11471cda092a0c26e90ac486fa22f35287aa49e) Run the LAN harness headless - [`5be7c02`](https://github.com/horizon-rust/horizon/commit/5be7c02d0cfbdd43a90c9c79a48d1edb3da9df05) Cover the mining dig stop in the LAN harness (#1340, #1908) - [`10d0132`](https://github.com/horizon-rust/horizon/commit/10d0132a533071b24b61a54b9088d7143578d358) Merge remote-tracking branch 'upstream/main' into fix/mining-dig-stop-check - [`14dac74`](https://github.com/horizon-rust/horizon/commit/14dac749e370b00b5d8aee3e976d94294c5b0f7d) Merge remote-tracking branch 'upstream/main' into fix/thrown-projectile-flight - [`bcf2a34`](https://github.com/horizon-rust/horizon/commit/bcf2a34a10bf32868d47112ddd1b1cb86a8263c0) Merge #2563 ### 📊 Changes **3 files changed** (+182 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote_projectiles.rs` (+74 -5) 📝 `tools/lan_e2e.py` (+63 -2) 📝 `tools/test_remote_fireball_parity.py` (+45 -5) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why Both #1340 and #1908 are **already fixed on `main`**; this pull request adds the regression coverage that was missing and proves the fix, by reverting it and watching the two symptoms come back. * **#1340** (creative keeps destroying replacement blocks) was fixed by `9624e998` "Clear a creative player's dig after the block breaks on the server" (2026-10-24). * **#1908** (a constant "someone punching stone" after a dead bush) was fixed by `09ff66bf` "Fix stale server digging after instant survival breaks" (PR #1922, merged 2026-10-26). Both had the same root cause and the same shape: a block the client breaks **at once** sends no `STOP_DESTROY_BLOCK` and no `ABORT_DESTROY_BLOCK` (vanilla's `MultiPlayerGameMode` leaves `isDestroying` false in creative and in the insta-mine branch), so the server has to forget the dig on its own, as `ServerPlayerGameMode.handleBlockBreakAction` does (`destroyAndAck` for the creative and insta-mine branches, which leave `isDestroyingBlock` false). Without that, the server kept the dig and kept mining the emptied cell: * in creative, the server broke whatever was put in the cell again, every destroy delay — the stone put back was gone (#1340); * in survival, the emptied cell was still "dug" every tick. Air's sound group in Horizon is stone (`minecraft:block.stone.hit`), which is exactly the "someone punching stone" the reporter heard, and the dig went on until another block was mined (#1908). The new `dig_stop` check in `tools/lan_e2e.py` covers both, for the host and the guest: it breaks a stone block in creative and a dead bush in survival with one left-click, releases the attack, waits 40 ticks, puts the block back and waits 100 more. The block must stay, the client must have no dig left, and no mining sound may be played. The second commit (`Run the LAN harness headless`) is a tooling enabler, not a fix: `HORIZON_E2E_HEADLESS=1` launches the games with `--offscreen --no-pause`, so the suite runs on a machine with no focused window. Without it the games pause on the focus loss and `wait_ready` never completes (1 fps, no chunks). macOS keeps its offscreen launch as before. ## Vanilla reference * `net.minecraft.client.multiplayer.MultiPlayerGameMode.startDestroyBlock` — in creative (`getAbilities().instabuild`) it destroys the block at once and sends `START_DESTROY_BLOCK`, and leaves `isDestroying` false; in the insta-mine branch it destroys the block and likewise leaves `isDestroying` false. So the client sends **no** `STOP_DESTROY_BLOCK`/`ABORT_DESTROY_BLOCK` for those, and `stopDestroyBlock` (which only aborts when `isDestroying`) sends nothing either. * `net.minecraft.client.multiplayer.MultiPlayerGameMode.continueDestroyBlock` — the survival path that keeps digging and sends `STOP_DESTROY_BLOCK` at `destroyProgress >= 1.0F`; the creative path destroys the block and sends `START_DESTROY_BLOCK` again. * `net.minecraft.server.level.ServerPlayerGameMode.handleBlockBreakAction` — `START_DESTROY_BLOCK` with `instabuild` calls `destroyAndAck(pos, sequence, "creative destroy")` and returns, and the insta-mine branch calls `destroyAndAck(pos, sequence, "insta mine")`; neither sets `isDestroyingBlock`, so the server has no dig to keep. `ABORT_DESTROY_BLOCK` calls `abortDestroyBlock`, and `STOP_DESTROY_BLOCK` breaks the block only when the server's own progress is at least 70 % done. * `net.minecraft.server.level.ServerPlayerGameMode.tick` — the delayed destroy (`hasDelayedDestroy`) and the crack progress, i.e. what a dig that is still going looks like on the server. * `net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.getDestroyProgress` and `SoundType`/`BlockSoundGroup` — the per-block destroy progress and the sound group; in Horizon the air block's sound group is stone, which is what made the stale dig sound like "someone punching stone". ## Self-check The LAN harness, from this branch (`HORIZON_E2E_HEADLESS=1`, the host on its server thread, the default): ``` $ python3 tools/lan_e2e.py --bin-dir target/fast --check dig_stop --check instant_digging [lan] dig_stop: PASS {'host': {'creative broken': 'minecraft:air', 'creative mining': None, 'creative replacement': ['minecraft:stone', 'minecraft:stone'], 'creative hits': {'host': 0, 'guest': 0}, 'survival broken': 'minecraft:air', 'survival mining': None, 'survival replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 0, 'guest': 0}}, 'guest': {'creative broken': 'minecraft:air', 'creative mining': None, 'creative replacement': ['minecraft:stone', 'minecraft:stone'], 'creative hits': {'host': 0, 'guest': 0}, 'survival broken': 'minecraft:air', 'survival mining': None, 'survival replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 0, 'guest': 0}}} [lan] instant_digging: PASS {'host': {'broken': 'minecraft:air', 'stone_hits': 0, 'replacement': 'minecraft:dead_bush'}, 'guest': {'broken': 'minecraft:air', 'stone_hits': 0, 'replacement': 'minecraft:dead_bush'}} ``` The same check with the upstream fix reverted locally (the `play.digging = None` block in `crates/horizon-client/src/game/lan_actions.rs` removed, everything else unchanged) reproduces both reports: ``` [lan] dig_stop: FAIL AssertionError("host creative: the server kept digging: {'creative broken': 'minecraft:air', 'creative mining': None, 'creative replacement': ['minecraft:air', 'minecraft:air'], 'creative hits': {'host': 0, 'guest': 0}, 'survival broken': 'minecraft:air', 'survival mining': None, 'survival replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 33, 'guest': 33}}") ``` * `creative replacement: ['minecraft:air', 'minecraft:air']` — the stone put back was destroyed again, on the server and on the client (#1340). * `survival hits: {'host': 33, 'guest': 33}` — 33 `minecraft:block.stone.hit` sounds after the instant break of the dead bush, i.e. the constant "someone punching stone" (#1908). `dig_stop` also passes with the host in the other mode (`--in-frame`): ``` $ python3 tools/lan_e2e.py --bin-dir target/fast --in-frame --check dig_stop [lan] dig_stop: PASS {... 'creative replacement': ['minecraft:stone', 'minecraft:stone'], 'survival hits': {'host': 0, 'guest': 0} ...} ``` 🤖 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 04:17:09 +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#4439
No description provided.