[PR #4574] [MERGED] Native mods: play vanilla sounds from server code #5702

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4574
Author: @arismoko
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @levzzz5154

Base: main ← Head: native-server-sounds


📝 Commits (2)

  • 406648e Native mods: play vanilla sounds from server code
  • 809dd63 Merge hr/main; renumber native sounds hook to API 25

📊 Changes

7 files changed (+125 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/creatures.rs (+12 -0)
📝 crates/horizon-client/src/game/lan.rs (+1 -0)
📝 crates/horizon-client/src/game/lan_particles.rs (+50 -11)
📝 crates/horizon-client/src/game/native_hooks.rs (+47 -7)
📝 crates/horizon-client/src/lan/containers.rs (+6 -1)
📝 docs/native-mods.md (+6 -0)

📄 Description

🤖 Opened by Aria's agent swarm, Dyna, not by Aria.

Add GameLevel::native_play_sound for vanilla sound events on the authoritative server. The helper validates the position, sound source, volume and pitch, then queues the request. It also works while a guest action holds the server host. The server checks the sound registry at dispatch and sends to nearby players in the originating dimension. The return value means queued, not heard; unknown events are discarded at dispatch.

The counterpart is vanilla Level.playSound. NeoForge documents sounds at https://docs.neoforged.net/docs/resources/client/sounds/. This helper broadcasts to nearby players and does not expose the optional excluded player. It uses API next. Queued sounds share the server sound-seed source from #4595.

Fixes #4400.

Checks

On 5cbd4c8ebf90988c315c1a69d6d3216fbbe10854, the quick readiness run passed 1290 horizon-client tests and workspace clippy.

In the real game on arch, a throwaway native mod queued a note-block sound while the server host was held. On the server thread, the host received-sound counter rose from 4 to 7 and the guest counter rose from 2 to 5. On a dedicated server, the guest counter rose from 0 to 3. Both checks used the rebased head with the throwaway mod and isolated data. Audio was disabled.

Head 406648ebe is 5cbd4c8eb rebased onto main after #4746 merged; only the surrounding docs lines changed (git range-diff shows the same patch), so the checks above, run on 5cbd4c8eb, still apply.

pr_ready (tools/pr_ready.py --quick --base HEAD^ on desktop, against HEAD^ at af2df073d, 3 min 10 s)

Check Result
Scope ✅ 7 files, +124 −18
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 486 passed (28 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 17 s)
tests: horizon-client ✅ 1290 passed (1 min 18 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)

🤖 Generated with Dyna


🔄 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/4574 **Author:** [@arismoko](https://github.com/arismoko) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `native-server-sounds` --- ### 📝 Commits (2) - [`406648e`](https://github.com/horizon-rust/horizon/commit/406648ebe2cac35f55e2918cee6b92ec2c7c397a) Native mods: play vanilla sounds from server code - [`809dd63`](https://github.com/horizon-rust/horizon/commit/809dd639e267e9439c06d53ce0074062332ede0b) Merge hr/main; renumber native sounds hook to API 25 ### 📊 Changes **7 files changed** (+125 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+12 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan_particles.rs` (+50 -11) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+47 -7) 📝 `crates/horizon-client/src/lan/containers.rs` (+6 -1) 📝 `docs/native-mods.md` (+6 -0) </details> ### 📄 Description > 🤖 Opened by Aria's agent swarm, Dyna, not by Aria. Add `GameLevel::native_play_sound` for vanilla sound events on the authoritative server. The helper validates the position, sound source, volume and pitch, then queues the request. It also works while a guest action holds the server host. The server checks the sound registry at dispatch and sends to nearby players in the originating dimension. The return value means queued, not heard; unknown events are discarded at dispatch. The counterpart is vanilla `Level.playSound`. NeoForge documents sounds at https://docs.neoforged.net/docs/resources/client/sounds/. This helper broadcasts to nearby players and does not expose the optional excluded player. It uses API next. Queued sounds share the server sound-seed source from #4595. Fixes #4400. ## Checks On `5cbd4c8ebf90988c315c1a69d6d3216fbbe10854`, the quick readiness run passed 1290 horizon-client tests and workspace clippy. In the real game on arch, a throwaway native mod queued a note-block sound while the server host was held. On the server thread, the host received-sound counter rose from 4 to 7 and the guest counter rose from 2 to 5. On a dedicated server, the guest counter rose from 0 to 3. Both checks used the rebased head with the throwaway mod and isolated data. Audio was disabled. Head `406648ebe` is `5cbd4c8eb` rebased onto main after #4746 merged; only the surrounding docs lines changed (`git range-diff` shows the same patch), so the checks above, run on `5cbd4c8eb`, still apply. **pr_ready** (`tools/pr_ready.py --quick --base HEAD^` on desktop, against HEAD^ at af2df073d, 3 min 10 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +124 −18 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 486 passed (28 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 17 s) | | tests: horizon-client | ✅ 1290 passed (1 min 18 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) | 🤖 Generated with Dyna --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:25 +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#5702
No description provided.