[PR #4036] [MERGED] Food grows a tamed baby cat or wolf instead of making it sit #5372

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4036
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-2780-babypet


📝 Commits (1)

  • 450ff69 Food grows a tamed baby cat or wolf instead of making it sit

📊 Changes

2 files changed (+66 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+9 -7)
📝 crates/horizon-client/src/mobs/ai.rs (+57 -4)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally.

What and why

Feeding a tamed baby cat (fish) or wolf (meat) made it sit or stand up, and it never grew. This is the "Cats: cannot grow up babies using food" item of #2780. Baby wolves had the same problem.

Cause: in interact_mob, the owner's sit toggle for tamed wolves and cats ran unless the food could start breeding (age == 0 && in_love <= 0). A tamed baby has a negative age, so the sit arm caught the click before the generic Animal.mobInteract arm (feed_animal) could grow it.

In vanilla, Wolf.mobInteract and Cat.mobInteract call TamableAnimal/Animal.mobInteract first and toggle setOrderedToSit only when that call did not consume the click. Animal.mobInteract takes the food in two cases: from an adult at age 0 that canFallInLove, and from a baby that canAgeUp (isBaby() && !isAgeLocked()), which it grows with ageUp(getSpeedUpSecondsWhenFeeding(-age), true).

Fix: a new mobs::ai::takes_food(m) implements that test. Both sit guards and feed_animal now use it, so they can't drift apart. As a side effect, feed_animal now leaves an age-locked baby alone, as canAgeUp does: the click is used up and no food is taken, which is what the generic arm already did for adults that can't breed.

Part of #2780

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Read with javap on the 26.3 client jar:

  • Wolf.mobInteract and Cat.mobInteract (net.minecraft.world.entity.animal.wolf.Wolf, ...feline.Cat): call super.mobInteract first, then if (!result.consumesAction() && isOwnedBy(player)) setOrderedToSit(...).
  • Animal.mobInteract: isFood → age == 0 && canFallInLove() → setInLove; otherwise canAgeUp() → ageUp(getSpeedUpSecondsWhenFeeding(-age), true).
  • AgeableMob.canAgeUp: isBaby() && !isAgeLocked(). Animal.canFallInLove: inLove <= 0.

Checked by the new unit test mobs::ai::feed_tests::food_grows_a_tamed_baby_cat_or_wolf (tamed baby wolf and cat take their food and grow a tenth; age-locked babies, adults in love and adults on breeding cooldown don't). The existing tools/test_mob_ai_parity.py feed scenarios still match vanilla tick for tick.

Self-check

tools/pr_ready.py doesn't run on Windows, so I ran the steps by hand (Windows 11):

  • cargo fmt --all -- --check: clean
  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean
  • cargo test -p horizon-client --lib feed_tests:
    • before (the takes_food body set back to the old guard predicate age == 0 && in_love <= 0, and feed_animal restored): FAILED, minecraft:wolf: a tamed baby takes its food
    • after: ok, 1 passed
  • cargo test -p horizon-client --lib mobs::ai: 5 passed. cargo test -p horizon-client --lib tame: 1 passed.
  • python tools/test_mob_ai_parity.py --only feed_cow feed_cow_baby feed_pig feed_pig_baby feed_sheep feed_sheep_baby feed_chicken feed_chicken_baby: 8/8 scenarios match entirely, 648/648 mob-ticks.
  • In game, single player with the integrated server on its thread, creative, with a NoAI baby wolf and baby cat tamed with bone and fish. Read back with /data get entity:
    • before: each beef/cod click flipped Sitting (1b, 0b, 1b) and Age stayed at -24000.
    • after: Age went -24000 → -21600 → -19440 → -17500 (a tenth each time, as vanilla) and Sitting didn't change.
    • after: an adult tamed wolf falls in love on the first beef, and the second beef (already in love) toggles sitting. A non-food item (bone on the kitten) still toggles sitting.
  • A LAN guest's clicks run the same interact_mob (with lan_acting swapped in), so there's no separate guest code path. I didn't run a guest separately.

Screenshots

Before: right-clicking a tamed baby cat with cod or a tamed baby wolf with raw beef only makes it sit down or stand up, and it stays a baby. After: each click grows it by a tenth of its remaining baby time, and it stays sitting or standing as it was.

🤖 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/4036 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-2780-babypet` --- ### 📝 Commits (1) - [`450ff69`](https://github.com/horizon-rust/horizon/commit/450ff69b4ea7451ba0e7302f6daf57acf8bfff46) Food grows a tamed baby cat or wolf instead of making it sit ### 📊 Changes **2 files changed** (+66 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+9 -7) 📝 `crates/horizon-client/src/mobs/ai.rs` (+57 -4) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why Feeding a tamed baby cat (fish) or wolf (meat) made it sit or stand up, and it never grew. This is the "Cats: cannot grow up babies using food" item of #2780. Baby wolves had the same problem. Cause: in `interact_mob`, the owner's sit toggle for tamed wolves and cats ran unless the food could start breeding (`age == 0 && in_love <= 0`). A tamed baby has a negative age, so the sit arm caught the click before the generic `Animal.mobInteract` arm (`feed_animal`) could grow it. In vanilla, `Wolf.mobInteract` and `Cat.mobInteract` call `TamableAnimal`/`Animal.mobInteract` first and toggle `setOrderedToSit` only when that call did not consume the click. `Animal.mobInteract` takes the food in two cases: from an adult at age 0 that `canFallInLove`, and from a baby that `canAgeUp` (`isBaby() && !isAgeLocked()`), which it grows with `ageUp(getSpeedUpSecondsWhenFeeding(-age), true)`. Fix: a new `mobs::ai::takes_food(m)` implements that test. Both sit guards and `feed_animal` now use it, so they can't drift apart. As a side effect, `feed_animal` now leaves an age-locked baby alone, as `canAgeUp` does: the click is used up and no food is taken, which is what the generic arm already did for adults that can't breed. Part of #2780 ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Read with javap on the 26.3 client jar: - `Wolf.mobInteract` and `Cat.mobInteract` (`net.minecraft.world.entity.animal.wolf.Wolf`, `...feline.Cat`): call `super.mobInteract` first, then `if (!result.consumesAction() && isOwnedBy(player)) setOrderedToSit(...)`. - `Animal.mobInteract`: `isFood` → `age == 0 && canFallInLove()` → `setInLove`; otherwise `canAgeUp()` → `ageUp(getSpeedUpSecondsWhenFeeding(-age), true)`. - `AgeableMob.canAgeUp`: `isBaby() && !isAgeLocked()`. `Animal.canFallInLove`: `inLove <= 0`. Checked by the new unit test `mobs::ai::feed_tests::food_grows_a_tamed_baby_cat_or_wolf` (tamed baby wolf and cat take their food and grow a tenth; age-locked babies, adults in love and adults on breeding cooldown don't). The existing `tools/test_mob_ai_parity.py` feed scenarios still match vanilla tick for tick. ## Self-check `tools/pr_ready.py` doesn't run on Windows, so I ran the steps by hand (Windows 11): - `cargo fmt --all -- --check`: clean - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean - `cargo test -p horizon-client --lib feed_tests`: - before (the `takes_food` body set back to the old guard predicate `age == 0 && in_love <= 0`, and `feed_animal` restored): **FAILED**, `minecraft:wolf: a tamed baby takes its food` - after: **ok**, 1 passed - `cargo test -p horizon-client --lib mobs::ai`: 5 passed. `cargo test -p horizon-client --lib tame`: 1 passed. - `python tools/test_mob_ai_parity.py --only feed_cow feed_cow_baby feed_pig feed_pig_baby feed_sheep feed_sheep_baby feed_chicken feed_chicken_baby`: 8/8 scenarios match entirely, 648/648 mob-ticks. - In game, single player with the integrated server on its thread, creative, with a NoAI baby wolf and baby cat tamed with bone and fish. Read back with `/data get entity`: - before: each beef/cod click flipped `Sitting` (1b, 0b, 1b) and `Age` stayed at -24000. - after: `Age` went -24000 → -21600 → -19440 → -17500 (a tenth each time, as vanilla) and `Sitting` didn't change. - after: an adult tamed wolf falls in love on the first beef, and the second beef (already in love) toggles sitting. A non-food item (bone on the kitten) still toggles sitting. - A LAN guest's clicks run the same `interact_mob` (with `lan_acting` swapped in), so there's no separate guest code path. I didn't run a guest separately. ## Screenshots Before: right-clicking a tamed baby cat with cod or a tamed baby wolf with raw beef only makes it sit down or stand up, and it stays a baby. After: each click grows it by a tenth of its remaining baby time, and it stays sitting or standing as it was. 🤖 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 05:12:07 +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#5372
No description provided.