[PR #2350] [MERGED] Play mining hit sounds once, from the server's destroy level events #4230

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

📋 Pull Request Information

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

Base: main ← Head: fix/mining-hit-sound-level-events


📝 Commits (3)

  • 7f5e338 Play mining hit sounds once, from the server's destroy level events
  • 0c127ec Stub breaking_block_effects in the remote mining test fixture
  • 73aef0c Merge main into fix/mining-hit-sound-level-events

📊 Changes

5 files changed (+61 additions, -31 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+30 -15)
📝 crates/horizon-client/src/game/lan.rs (+3 -2)
📝 crates/horizon-client/src/game/level_particles.rs (+24 -0)
📝 crates/horizon-client/src/game/remote.rs (+3 -14)
📝 tests/test_remote_mining.py (+1 -0)

📄 Description

What and why

Breaking any block played the hit sound too often and doubled. A client of the server (single player runs as one) played its own hit sound and cracks every fourth tick, while the server ran the same mining code for the guest and sent each sound it made back to the digger as well. The two copies were out of phase.

Vanilla does neither. The client plays the first hit only, and the server sends a level event every tick the player digs: 2020 on every fourth tick (hit sound and crack), 2019 on the others (crack only), to everyone nearby including the digger.

This follows rdbtCVS's note on the issue that the fix needs the missing 2019/2020 level event handlers instead of just muting a sound.

  • The server (guest mining in tick_mining) sends 2019/2020 every tick with the face, to the digger too, instead of a captured raw sound. An instant break at the start sends none, and an unbreakable block still counts ticks, as vanilla does.
  • Level events 2019 and 2020 are handled: a crack on that face, and the hit sound for 2020 only.
  • A remote client plays the first hit and crack once when digging starts and nothing more while digging.
  • The in-frame path (tick_local_hand) already played each hit once and is unchanged.

Fixes #2277.

Vanilla reference

  • ServerPlayerGameMode.tick: the 2019/2020 level event per tick, (gameTicks - destroyProgressStart) % 4 == 0 picks 2020.
  • LevelEventHandler cases 2019 and 2020, then ClientLevel.addBreakingBlockEffects and playBreakingSound (volume (volume + 1) / 8, pitch times 0.5).
  • MultiPlayerGameMode.startDestroyBlock: the one local addBreakingBlockEffects at the start; continueDestroyBlock plays nothing.

Self-check

cargo check -p horizon-client passes.


🔄 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/2350 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mining-hit-sound-level-events` --- ### 📝 Commits (3) - [`7f5e338`](https://github.com/horizon-rust/horizon/commit/7f5e3384b375c822d634f00a020f13f4992263f1) Play mining hit sounds once, from the server's destroy level events - [`0c127ec`](https://github.com/horizon-rust/horizon/commit/0c127ec1d9285a225d0cee0f29755b8f8fcaff8b) Stub breaking_block_effects in the remote mining test fixture - [`73aef0c`](https://github.com/horizon-rust/horizon/commit/73aef0ce8e6ed826256cf9061439c3e8d4aa3315) Merge main into fix/mining-hit-sound-level-events ### 📊 Changes **5 files changed** (+61 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+30 -15) 📝 `crates/horizon-client/src/game/lan.rs` (+3 -2) 📝 `crates/horizon-client/src/game/level_particles.rs` (+24 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+3 -14) 📝 `tests/test_remote_mining.py` (+1 -0) </details> ### 📄 Description ## What and why Breaking any block played the hit sound too often and doubled. A client of the server (single player runs as one) played its own hit sound and cracks every fourth tick, while the server ran the same mining code for the guest and sent each sound it made back to the digger as well. The two copies were out of phase. Vanilla does neither. The client plays the first hit only, and the server sends a level event every tick the player digs: 2020 on every fourth tick (hit sound and crack), 2019 on the others (crack only), to everyone nearby including the digger. This follows rdbtCVS's note on the issue that the fix needs the missing 2019/2020 level event handlers instead of just muting a sound. - The server (guest mining in `tick_mining`) sends 2019/2020 every tick with the face, to the digger too, instead of a captured raw sound. An instant break at the start sends none, and an unbreakable block still counts ticks, as vanilla does. - Level events 2019 and 2020 are handled: a crack on that face, and the hit sound for 2020 only. - A remote client plays the first hit and crack once when digging starts and nothing more while digging. - The in-frame path (`tick_local_hand`) already played each hit once and is unchanged. Fixes #2277. ## Vanilla reference - `ServerPlayerGameMode.tick`: the 2019/2020 level event per tick, `(gameTicks - destroyProgressStart) % 4 == 0` picks 2020. - `LevelEventHandler` cases 2019 and 2020, then `ClientLevel.addBreakingBlockEffects` and `playBreakingSound` (volume `(volume + 1) / 8`, pitch times 0.5). - `MultiPlayerGameMode.startDestroyBlock`: the one local `addBreakingBlockEffects` at the start; `continueDestroyBlock` plays nothing. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:15:39 +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#4230
No description provided.