[PR #4033] [MERGED] Wolves tilt their head at food they want #5370

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/4033
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-2780-wolfbeg


📝 Commits (1)

  • 3ffaf67 Wolves tilt their head at food they want

📊 Changes

4 files changed (+48 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game/lan.rs (+5 -0)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+31 -0)
📝 crates/horizon-client/src/mobs/sync.rs (+3 -1)
📝 crates/horizon-client/src/mobs/tame.rs (+9 -4)

📄 Description

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

What and why

Part of #2780 (the wolves' item: "when holding a bone or meat they will not do the move").

Wolves never tilted their head at a player holding a bone or meat. BegGoal runs on the server copy and sets the begging flag, and the server's own interestedAngle eased toward it, but nobody saw it. The LAN host's mob data (game/lan.rs) sent the wolf's entries 21, 22 and 23 but not 20 (Wolf.DATA_INTERESTED_ID). The client's reader (game/remote_mob_data.rs) had no case for it either, and a remote wolf had no client tick to ease the angle. Single player joins its server thread the same way a LAN guest does, so the tilt was missing everywhere.

The fix:

  • lan.rs sends entry 20 (BOOLEAN) while the wolf begs. Its false default goes in defaults, so the flag goes back to false when begging ends.
  • remote_mob_data.rs reads (Wolf, 20) into the wolf's begging flag.
  • mobs/tame.rs: the part of Wolf.tick that both sides run is now interest_tick. It keeps the previous value and eases interestedAngle 0.4 of the way toward the flag. The server's ai_step calls it (after its alive check), and so does sync::client_tick for a client's living wolves, as Wolf.tick returns early when !isAlive(). The renderer already turned that value into the head's roll (getHeadRollAngle: lerp × 0.15π).

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

Checked with javap on the 26.3 jars:

  • net.minecraft.world.entity.animal.wolf.Wolf: the static init defines DATA_INTERESTED_ID (Boolean) first among Wolf's entries, before DATA_COLLAR_COLOR, DATA_ANGER_END_TIME, DATA_VARIANT_ID and DATA_SOUND_VARIANT_ID. That makes it entry 20, before the 21/22/23 Horizon already sends. defineSynchedData defaults it to false.
  • Wolf.tick runs on both sides: after if (!isAlive()) return, interestedAngleO = interestedAngle, then interestedAngle += ((isInterested() ? 1 : 0) - interestedAngle) * 0.4f.
  • Wolf.getHeadRollAngle(partial): Mth.lerp(partial, interestedAngleO, interestedAngle) * 0.15f * π.
  • net.minecraft.world.entity.ai.goal.BegGoal.start / stop: Wolf.setIsInterested(true / false).

No parity harness covers synched mob data or the wolf's animation. The new unit test game::remote_mob_data::tests::a_wolf_tilts_its_head_while_the_server_says_it_begs checks the client side: it applies entry 20, runs sync::client_tick and checks the eased values 0.4 and 0.64, the partial-tick lerp, and the ease back to 0 once the flag clears.

Self-check

tools/pr_ready.py doesn't run on Windows (it needs SIGHUP), so I ran its steps by hand (CARGO_TARGET_DIR set to a private target folder):

  • cargo fmt --all -- --check: clean.
  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean.
  • cargo test --profile fast -p horizon-client --bin horizon-client a_wolf_ with the code changes reverted (test only):
    a_wolf_tilts_its_head_while_the_server_says_it_begs ... FAILED (assertion failed: (m.anim.v[tame::INTEREST] - 0.4).abs() < 1e-6), 1 passed, 1 failed.
  • cargo test --profile fast -p horizon-client --bin horizon-client remote_mob_data with the fix: 12 passed, 0 failed.
  • cargo test -p horizon-client --lib -- mobs::: 130 passed, 0 failed, 6 ignored.
  • cargo test --profile fast -p horizon-client --bin horizon-client -- wolf tame beg: 2 passed.
  • In game (cargo build --profile fast -p horizon-client --bins), single player on the server thread. I summoned a wolf on a flat platform (with Slowness so it stays put) and held a bone 3 blocks away:
    • Before: the wolf looks at the player with its head straight, in every screenshot over about 8 seconds.
    • After: the head tilts. When I switch to an empty hand it straightens.
  • LAN guest (host lan open, second game connect 127.0.0.1:<port> Guest, host moved more than 8 blocks away): the guest holds a bone and sees the wolf tilt its head at it.

Screenshots

before: holding a bone in front of a wolf, its head stays straight

after: the wolf tilts its head at the bone

Before: a wolf facing a player who holds a bone keeps its head straight. After: its head rolls to one side while the player holds the bone, and straightens when the hand is empty. A LAN guest holding a bone sees the same tilt.

🤖 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/4033 **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-wolfbeg` --- ### 📝 Commits (1) - [`3ffaf67`](https://github.com/horizon-rust/horizon/commit/3ffaf67e22e39db71b6eb4d3be8954a467a62d81) Wolves tilt their head at food they want ### 📊 Changes **4 files changed** (+48 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan.rs` (+5 -0) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+31 -0) 📝 `crates/horizon-client/src/mobs/sync.rs` (+3 -1) 📝 `crates/horizon-client/src/mobs/tame.rs` (+9 -4) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why Part of #2780 (the wolves' item: "when holding a bone or meat they will not do the move"). Wolves never tilted their head at a player holding a bone or meat. `BegGoal` runs on the server copy and sets the begging flag, and the server's own `interestedAngle` eased toward it, but nobody saw it. The LAN host's mob data (`game/lan.rs`) sent the wolf's entries 21, 22 and 23 but not 20 (`Wolf.DATA_INTERESTED_ID`). The client's reader (`game/remote_mob_data.rs`) had no case for it either, and a remote wolf had no client tick to ease the angle. Single player joins its server thread the same way a LAN guest does, so the tilt was missing everywhere. The fix: - `lan.rs` sends entry 20 (BOOLEAN) while the wolf begs. Its `false` default goes in `defaults`, so the flag goes back to false when begging ends. - `remote_mob_data.rs` reads `(Wolf, 20)` into the wolf's begging flag. - `mobs/tame.rs`: the part of `Wolf.tick` that both sides run is now `interest_tick`. It keeps the previous value and eases `interestedAngle` 0.4 of the way toward the flag. The server's `ai_step` calls it (after its alive check), and so does `sync::client_tick` for a client's living wolves, as `Wolf.tick` returns early when `!isAlive()`. The renderer already turned that value into the head's roll (`getHeadRollAngle`: lerp × 0.15π). ## 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 Checked with javap on the 26.3 jars: - `net.minecraft.world.entity.animal.wolf.Wolf`: the static init defines `DATA_INTERESTED_ID` (Boolean) first among Wolf's entries, before `DATA_COLLAR_COLOR`, `DATA_ANGER_END_TIME`, `DATA_VARIANT_ID` and `DATA_SOUND_VARIANT_ID`. That makes it entry 20, before the 21/22/23 Horizon already sends. `defineSynchedData` defaults it to false. - `Wolf.tick` runs on both sides: after `if (!isAlive()) return`, `interestedAngleO = interestedAngle`, then `interestedAngle += ((isInterested() ? 1 : 0) - interestedAngle) * 0.4f`. - `Wolf.getHeadRollAngle(partial)`: `Mth.lerp(partial, interestedAngleO, interestedAngle) * 0.15f * π`. - `net.minecraft.world.entity.ai.goal.BegGoal.start` / `stop`: `Wolf.setIsInterested(true / false)`. No parity harness covers synched mob data or the wolf's animation. The new unit test `game::remote_mob_data::tests::a_wolf_tilts_its_head_while_the_server_says_it_begs` checks the client side: it applies entry 20, runs `sync::client_tick` and checks the eased values 0.4 and 0.64, the partial-tick lerp, and the ease back to 0 once the flag clears. ## Self-check `tools/pr_ready.py` doesn't run on Windows (it needs SIGHUP), so I ran its steps by hand (CARGO_TARGET_DIR set to a private target folder): - `cargo fmt --all -- --check`: clean. - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean. - `cargo test --profile fast -p horizon-client --bin horizon-client a_wolf_` with the code changes reverted (test only): `a_wolf_tilts_its_head_while_the_server_says_it_begs ... FAILED` (`assertion failed: (m.anim.v[tame::INTEREST] - 0.4).abs() < 1e-6`), 1 passed, 1 failed. - `cargo test --profile fast -p horizon-client --bin horizon-client remote_mob_data` with the fix: 12 passed, 0 failed. - `cargo test -p horizon-client --lib -- mobs::`: 130 passed, 0 failed, 6 ignored. - `cargo test --profile fast -p horizon-client --bin horizon-client -- wolf tame beg`: 2 passed. - In game (`cargo build --profile fast -p horizon-client --bins`), single player on the server thread. I summoned a wolf on a flat platform (with Slowness so it stays put) and held a bone 3 blocks away: - Before: the wolf looks at the player with its head straight, in every screenshot over about 8 seconds. - After: the head tilts. When I switch to an empty hand it straightens. - LAN guest (host `lan open`, second game `connect 127.0.0.1:<port> Guest`, host moved more than 8 blocks away): the guest holds a bone and sees the wolf tilt its head at it. ## Screenshots ![before: holding a bone in front of a wolf, its head stays straight](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/2780-wolfbeg-1.png) ![after: the wolf tilts its head at the bone](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/2780-wolfbeg-2.png) Before: a wolf facing a player who holds a bone keeps its head straight. After: its head rolls to one side while the player holds the bone, and straightens when the hand is empty. A LAN guest holding a bone sees the same tilt. 🤖 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#5370
No description provided.