[PR #81] [MERGED] Feeding sounds: each animal's own eating sound, or none, as in vanilla #2312

Closed
opened 2026-11-02 15:54:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/feeding-sounds-68


📝 Commits (1)

  • f1cc118 Feeding sounds: each animal's own eating sound, or none, as in vanilla

📊 Changes

8 files changed (+205 additions, -34 deletions)

View changed files

📝 crates/horizon-client/examples/mob_ai_probe.rs (+17 -0)
📝 crates/horizon-client/src/entity_nbt.rs (+2 -0)
📝 crates/horizon-client/src/game/creatures.rs (+46 -30)
📝 crates/horizon-client/src/game/nautili.rs (+2 -2)
📝 crates/horizon-client/src/mobs.rs (+5 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+108 -2)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java (+15 -0)
📝 tools/test_mob_ai_parity.py (+10 -0)

📄 Description

What was wrong

Feeding an animal played entity.generic.eat for every species without an entry in Horizon's small table (cows, sheep, chickens, rabbits, turtles, bees, pandas…), with a pitch drawn from the level's random. Vanilla 26.3 plays nothing for most of them.

What vanilla does

  • Animal.mobInteract (food in hand): usePlayerItem, then setInLove for an adult or ageUp(getSpeedUpSecondsWhenFeeding(-age), true) for a baby, then playEatingSound().
  • Animal.playEatingSound() is empty. Only these override it: Armadillo, Pig (makeSound: sound volume and voice pitch), SulfurCube (makeSound, entity.small_sulfur_cube.eat), Cat, Fox (playSound(…, 1, 1)), Frog (Level.playSound, volume 2), Goat, Sniffer (Level.playSound, pitch Mth.randomBetween(level random, 0.8, 1.2)), plus the nautili. Pigs and cats take the sound from their sound variant's adult or baby set.
  • TamableAnimal.feed (tame wolves and cats healed with food) also calls playEatingSound, so wolves are silent.
  • Strider.mobInteract adds entity.strider.eat after a successful feed; Parrot.isFood is false, and Parrot.mobInteract gives a wild parrot its food with entity.parrot.eat and a 1-in-10 tame.
  • AgeableMob.ageUp(seconds, true) records forcedAge and starts forcedAgeTimer (40). AgeableMob.aiStep then draws happy-villager particle positions from the mob's random every 4 ticks, on the server too.

The fix

  • mobs::ai::eating_sound: the overrides with their exact volume and pitch, otherwise silent.
  • mobs::ai::feed_animal: Animal.mobInteract's food branch, used by the game and by the mob AI probe. Babies use age_up(…, forced) with forced_age/forced_age_timer (saved as ForcedAge).
  • Game: cat taming and healing use the cat's eating sound; wolf healing is silent; new Parrot branch.
  • Baby pigs and chickens use their baby_sounds set (entity.baby_pig.*, entity.baby_chicken.*) for ambient, hurt and death sounds, as their step sounds already did.

Tests

  • Mob AI harness (tools/test_mob_ai_parity.py): a new feed TICK MOB ITEM event (the oracle calls the real Animal.mobInteract on the vanilla server's mob). 8 new scenarios feed adult and baby cows, pigs, sheep and chickens twice; sounds and AI state are compared every tick. 100/100 scenarios match entirely, 34,328/34,328 mob-ticks.
  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace pass; tools/check_public_tree.py passes.

Left open

  • Pig and cat sound variants (big/mini pigs, royal cats) are not modelled; Horizon plays the classic set for every sound of these mobs, so eating does too.
  • Armadillo, fox, frog and strider AI already diverge from vanilla from the first ticks in the mob AI probe (existing gaps), so they have no feed scenario yet. Their eating sounds follow the bytecode above.
  • Wolf and cat babies' own baby sounds (whine/pant/purr variants) are not included.

Fixes #68

🤖 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/81 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/feeding-sounds-68` --- ### 📝 Commits (1) - [`f1cc118`](https://github.com/horizon-rust/horizon/commit/f1cc118df0570604b1db2828da20cd67c39411a6) Feeding sounds: each animal's own eating sound, or none, as in vanilla ### 📊 Changes **8 files changed** (+205 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/mob_ai_probe.rs` (+17 -0) 📝 `crates/horizon-client/src/entity_nbt.rs` (+2 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+46 -30) 📝 `crates/horizon-client/src/game/nautili.rs` (+2 -2) 📝 `crates/horizon-client/src/mobs.rs` (+5 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+108 -2) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java` (+15 -0) 📝 `tools/test_mob_ai_parity.py` (+10 -0) </details> ### 📄 Description ## What was wrong Feeding an animal played `entity.generic.eat` for every species without an entry in Horizon's small table (cows, sheep, chickens, rabbits, turtles, bees, pandas…), with a pitch drawn from the level's random. Vanilla 26.3 plays nothing for most of them. ## What vanilla does - `Animal.mobInteract` (food in hand): `usePlayerItem`, then `setInLove` for an adult or `ageUp(getSpeedUpSecondsWhenFeeding(-age), true)` for a baby, then `playEatingSound()`. - `Animal.playEatingSound()` is **empty**. Only these override it: `Armadillo`, `Pig` (`makeSound`: sound volume and voice pitch), `SulfurCube` (`makeSound`, `entity.small_sulfur_cube.eat`), `Cat`, `Fox` (`playSound(…, 1, 1)`), `Frog` (`Level.playSound`, volume 2), `Goat`, `Sniffer` (`Level.playSound`, pitch `Mth.randomBetween(level random, 0.8, 1.2)`), plus the nautili. Pigs and cats take the sound from their sound variant's adult or baby set. - `TamableAnimal.feed` (tame wolves and cats healed with food) also calls `playEatingSound`, so wolves are silent. - `Strider.mobInteract` adds `entity.strider.eat` after a successful feed; `Parrot.isFood` is false, and `Parrot.mobInteract` gives a wild parrot its food with `entity.parrot.eat` and a 1-in-10 tame. - `AgeableMob.ageUp(seconds, true)` records `forcedAge` and starts `forcedAgeTimer` (40). `AgeableMob.aiStep` then draws happy-villager particle positions from the mob's random every 4 ticks, on the server too. ## The fix - `mobs::ai::eating_sound`: the overrides with their exact volume and pitch, otherwise silent. - `mobs::ai::feed_animal`: Animal.mobInteract's food branch, used by the game and by the mob AI probe. Babies use `age_up(…, forced)` with `forced_age`/`forced_age_timer` (saved as `ForcedAge`). - Game: cat taming and healing use the cat's eating sound; wolf healing is silent; new Parrot branch. - Baby pigs and chickens use their `baby_sounds` set (`entity.baby_pig.*`, `entity.baby_chicken.*`) for ambient, hurt and death sounds, as their step sounds already did. ## Tests - Mob AI harness (`tools/test_mob_ai_parity.py`): a new `feed TICK MOB ITEM` event (the oracle calls the real `Animal.mobInteract` on the vanilla server's mob). 8 new scenarios feed adult and baby cows, pigs, sheep and chickens twice; sounds and AI state are compared every tick. **100/100 scenarios match entirely, 34,328/34,328 mob-ticks.** - `cargo fmt --check`, `cargo clippy --workspace --all-targets -D warnings` and `cargo test --workspace` pass; `tools/check_public_tree.py` passes. ## Left open - Pig and cat **sound variants** (big/mini pigs, royal cats) are not modelled; Horizon plays the classic set for every sound of these mobs, so eating does too. - Armadillo, fox, frog and strider AI already diverge from vanilla from the first ticks in the mob AI probe (existing gaps), so they have no feed scenario yet. Their eating sounds follow the bytecode above. - Wolf and cat babies' own baby sounds (whine/pant/purr variants) are not included. Fixes #68 🤖 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-02 15:54:52 +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#2312
No description provided.