[PR #2688] [MERGED] Bees buzz while they fly and guardians hum while their beam charges #4541

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

📋 Pull Request Information

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

Base: main ← Head: fix/mob-looping-sounds


📝 Commits (3)

  • 97d119b Loop the bee buzz and the guardian attack hum like vanilla
  • 7690ad2 Merge main into fix/mob-looping-sounds
  • b8eac21 Merge main into fix/mob-looping-sounds

📊 Changes

8 files changed (+242 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -0)
📝 crates/horizon-client/src/game/lan.rs (+5 -0)
➕ crates/horizon-client/src/game/mob_sounds.rs (+82 -0)
📝 crates/horizon-client/src/game/music.rs (+2 -0)
📝 crates/horizon-client/src/game/remote.rs (+4 -0)
📝 crates/horizon-client/src/mobs.rs (+2 -1)
📝 crates/horizon-client/src/mobs/guardian.rs (+17 -8)
📝 crates/horizon-client/src/sound_engine.rs (+123 -0)

📄 Description

What and why

Bees and guardians have looping sounds that vanilla runs on the client, and Horizon had neither (the guardian attack played once).

  • Bee buzz: every bee gets a looping sound that follows it (BeeFlyingSoundInstance). It is silent until the bee moves, then gets louder with its speed (volume 0 to 1.2 at speed 0.5), with the pitch range 0.7 to 1.1 (1.1 to 1.5 for a baby bee), using the same formulas as vanilla. An angry bee swaps it for the aggressive loop and back (BeeAggressiveSoundInstance). A silent bee plays nothing, and the loop ends when the bee is gone.
  • Guardian attack hum: the server now broadcasts entity event 21 when a guardian's beam starts, instead of playing the sound once. The client starts the looping sound (GuardianAttackSoundInstance): it is heard everywhere, with volume scale * scale and pitch 0.7 + 0.5 * scale, where scale is how far the beam has charged. When the beam ends the hum goes quiet again. A window that simulates the world itself starts the loop from the same event.

Vanilla starts a new hum for every beam and never ends the old ones while the guardian lives, so they pile up and add their volumes. Here a guardian keeps one hum, which follows the same charge.

The bee anger comes from the anger end time the mob carries. A client of the server thread only has it once the server sends it, so until then the bee on that side stays on the flying loop.

Vanilla reference

BeeSoundInstance, BeeFlyingSoundInstance, BeeAggressiveSoundInstance, GuardianAttackSoundInstance, ClientPacketListener.postAddEntitySoundInstance and handleEntityEvent (21), GuardianAttackGoal.tick, Guardian.getAttackAnimationScale.

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/2688 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mob-looping-sounds` --- ### 📝 Commits (3) - [`97d119b`](https://github.com/horizon-rust/horizon/commit/97d119b4e8995800f9e0e1de497af4c460758760) Loop the bee buzz and the guardian attack hum like vanilla - [`7690ad2`](https://github.com/horizon-rust/horizon/commit/7690ad27c27b23ee7b50e862c46702edfab162bb) Merge main into fix/mob-looping-sounds - [`b8eac21`](https://github.com/horizon-rust/horizon/commit/b8eac21b6f02d0478ba5855e9aa870e687c763f9) Merge main into fix/mob-looping-sounds ### 📊 Changes **8 files changed** (+242 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+5 -0) ➕ `crates/horizon-client/src/game/mob_sounds.rs` (+82 -0) 📝 `crates/horizon-client/src/game/music.rs` (+2 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+4 -0) 📝 `crates/horizon-client/src/mobs.rs` (+2 -1) 📝 `crates/horizon-client/src/mobs/guardian.rs` (+17 -8) 📝 `crates/horizon-client/src/sound_engine.rs` (+123 -0) </details> ### 📄 Description ## What and why Bees and guardians have looping sounds that vanilla runs on the client, and Horizon had neither (the guardian attack played once). - **Bee buzz:** every bee gets a looping sound that follows it (`BeeFlyingSoundInstance`). It is silent until the bee moves, then gets louder with its speed (volume 0 to 1.2 at speed 0.5), with the pitch range 0.7 to 1.1 (1.1 to 1.5 for a baby bee), using the same formulas as vanilla. An angry bee swaps it for the aggressive loop and back (`BeeAggressiveSoundInstance`). A silent bee plays nothing, and the loop ends when the bee is gone. - **Guardian attack hum:** the server now broadcasts entity event 21 when a guardian's beam starts, instead of playing the sound once. The client starts the looping sound (`GuardianAttackSoundInstance`): it is heard everywhere, with volume `scale * scale` and pitch `0.7 + 0.5 * scale`, where scale is how far the beam has charged. When the beam ends the hum goes quiet again. A window that simulates the world itself starts the loop from the same event. Vanilla starts a new hum for every beam and never ends the old ones while the guardian lives, so they pile up and add their volumes. Here a guardian keeps one hum, which follows the same charge. The bee anger comes from the anger end time the mob carries. A client of the server thread only has it once the server sends it, so until then the bee on that side stays on the flying loop. ## Vanilla reference `BeeSoundInstance`, `BeeFlyingSoundInstance`, `BeeAggressiveSoundInstance`, `GuardianAttackSoundInstance`, `ClientPacketListener.postAddEntitySoundInstance` and `handleEntityEvent` (21), `GuardianAttackGoal.tick`, `Guardian.getAttackAnimationScale`. ## 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:17:56 +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#4541
No description provided.