[PR #4083] [MERGED] Wet wolves darken and shake off the water on clients #5409

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

📋 Pull Request Information

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

Base: main ← Head: fix-2885-wolfwet


📝 Commits (6)

  • 5ee0425 Wet wolves darken and shake off the water on clients
  • 0b0a91e Mob AI parity: a wolf shaking dry and a wolf in the rain
  • 0646023 Merge hr/main into fix-2885-wolfwet
  • a2429b8 Merge remote-tracking branch 'hr/main' into fix/pr-4083
  • 6ca4b32 Fix main's test build: Aabb in_water stub in end_gateway, duplicate tests module and Items::load args in creatures
  • 988049b Merge hr/main into fix-2885-wolfwet

📊 Changes

4 files changed (+229 additions, -24 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+16 -4)
📝 crates/horizon-client/src/mobs/sync.rs (+1 -0)
📝 crates/horizon-client/src/mobs/tame.rs (+208 -20)
📝 tools/test_mob_ai_parity.py (+4 -0)

📄 Description

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

What and why

Part of #2885 ("wolves don't get darker when they are in water" and "wolves don't do the out of water animation").

A wolf's wet and shake state was computed only in tame::ai_step, which runs where the AI runs. A client of a server never computed it: sync::client_tick had no wolf branch and sync::entity_event ignored events 8 and 56, and the server never sent them. That client is the default single player (whose world runs on the server thread) and every LAN guest. So for them a wolf never darkened in water or rain (Wolf.getWetShade) and never shook dry.

The fix splits the wet and shaking part of Wolf.tick into shake_tick, which both sides now run:

  • Server (server_shake, called by ai_step): Wolf.aiStep starts the shake of a wet wolf that is on the ground and not pathing, and broadcasts entity event 8. In water or rain, Wolf.tick broadcasts event 56 and cancels the shake. The shake now starts and plays its sound in the same tick, as in vanilla. Before, it started one tick late.
  • Client (tame::client_tick, from the remote mob tick with Entity.isInRain at the wolf): the wolf becomes wet on its own in water or rain and runs the shake to the end, then it is dry. It draws the splashes. tame::entity_event handles Wolf.handleEntityEvent 8 (start) and 56 (cancel). The client plays no shake sound and does not cancel the shake by itself, as in vanilla.
  • Splash offsets now come from the wolf's own random, as in Wolf.tick: (nextFloat*2-1)*bbWidth*0.5 around x/z, y+0.8, with the wolf's motion. The server draws them too, so its random stream stays in step with vanilla.

As in vanilla, a wolf standing in the rain gets events 8 and 56 every tick: aiStep starts the shake and tick cancels it.

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

From javap -c -p on the 26.3 client jar, net.minecraft.world.entity.animal.wolf.Wolf:

  • aiStep: !isClientSide && isWet && !isShaking && !isPathFinding() && onGround() sets isShaking and resets shakeAnim/shakeAnimO, then broadcastEntityEvent(this, 8).
  • tick: isInWaterOrRain() sets isWet. On the server a shaking wolf gets broadcastEntityEvent(56) and cancelShake(). Otherwise a shaking wolf plays WOLF_SHAKE at shakeAnim == 0, steps shakeAnimO = shakeAnim; shakeAnim += 0.05, dries at shakeAnimO >= 2, and past 0.4 adds (int)(Mth.sin((shakeAnim-0.4)*π)*7) SPLASH particles at getX() + (nextFloat*2-1)*getBbWidth()*0.5, y+0.8, … with getDeltaMovement().
  • handleEntityEvent: 8 starts shaking, 56 calls cancelShake. getWetShade reads isWet and the shake.
  • Entity.isInRain (rain at the block position or at the box top).

Checked by:

  • Unit tests in mobs::tame::tests. They cover the client wolf darkening in water and rain, event 8 starting a 41-tick shake that splashes and ends dry with no client sound, event 56 cancelling it, and the server broadcasting 8 and 56.
  • tools/test_mob_ai_parity.py, two new scenarios. wolf_shake: a wolf climbs out of a one-block water hole and shakes, which checks the start tick, the sound draws and the splash draws. wolf_rain: a wolf in the rain.

Self-check

tools/pr_ready.py doesn't run on Windows (it needs SIGHUP), so I ran its steps by hand:

  • cargo fmt --all -- --check: clean
  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean
  • cargo test -p horizon-client --lib mobs::tame::tests, with this branch: 3 passed.
  • The same command with the fix's logic removed (the new hooks emptied, as on main, and server_shake holding main's ai_step body): 3 failed.
    • a_server_tells_the_clients_when_a_wolf_shakes: left: [] right: [8]
    • a_wolf_of_a_server_darkens_in_water_and_shakes_dry_on_its_event: tint 0xFFFFFFFF (white) instead of 0xFFBFBFBF ("wet in water")
    • a_wolf_of_a_server_stops_shaking_on_its_cancel_event: assertion failed: m.anim.v[SHAKE] > 0.4
  • cargo test -p horizon-client --lib mobs::: 137 passed, 0 failed (rebased on current main)
  • cargo test -p horizon-client --bin horizon-client game::remote: 23 passed (this includes remote_mob_data)
  • python tools/test_mob_ai_parity.py --only wolf_shake wolf_rain, with this branch: 2/2 scenarios match entirely, 302/302 mob-ticks. With the existing wolf scenarios (wolf_hurt, wolf_deep_water, llama_wolf) too: 5/5, 1066/1066 mob-ticks.
  • The same scenarios on main's code: wolf_shake first diverges at tick 64. Vanilla plays entity.wolf.shake there and Horizon plays nothing (two fewer random draws).
  • An earlier version of this branch that still used the old splash event diverged at tick 72, where vanilla's Wolf.tick draws the splash offsets. That is why the offsets now come from the wolf's random.
  • python tools/test_mob_ai_parity.py (full): 191/193 scenarios. The other two, creeper_alone and breeze_player, are last-bit float differences that main shows too.

In game, on a --profile fast build:

  • Default single player (server thread): a wolf in a 1×1 glass pen is put in a water block, then the water is removed.
  • LAN guest: the host opens to LAN and a second game joins as Guest to watch the same wolf.

Screenshots

a wolf leaving water, frame by frame; top: main (no darkening, no shake), bottom: this branch (wet shade, shake with water drops)

Same scene and seed: a wolf in a glass pen is put in water, then the water is removed. Frames are about 0.3 s apart.

  • Before (nightly 2026-10-29 a305d38): the wolf is just as bright right out of the water as when it is dry, with no shake and no splashes.
  • After, on the server thread: the wolf comes out grey (0.75 shade). It shakes with the body roll and throws blue splashes. It gets lighter through the shake and is white once dry, about 2 s later.
  • After, on a LAN guest: the guest sees the same darkening, shake and splashes.

🤖 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/4083 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-2885-wolfwet` --- ### 📝 Commits (6) - [`5ee0425`](https://github.com/horizon-rust/horizon/commit/5ee04257c5f88d84f123eebf622266458dc003bf) Wet wolves darken and shake off the water on clients - [`0b0a91e`](https://github.com/horizon-rust/horizon/commit/0b0a91e4d435605710ebd0c5ee21aebe821aa7d4) Mob AI parity: a wolf shaking dry and a wolf in the rain - [`0646023`](https://github.com/horizon-rust/horizon/commit/06460237d94c852aba3d3fd918a6e49fe1d0c159) Merge hr/main into fix-2885-wolfwet - [`a2429b8`](https://github.com/horizon-rust/horizon/commit/a2429b88646e7dd6bcc2fa846e0bf8badd5feb92) Merge remote-tracking branch 'hr/main' into fix/pr-4083 - [`6ca4b32`](https://github.com/horizon-rust/horizon/commit/6ca4b32d06bbec002bf85b932c0af3ef70ecd6e2) Fix main's test build: Aabb in_water stub in end_gateway, duplicate tests module and Items::load args in creatures - [`988049b`](https://github.com/horizon-rust/horizon/commit/988049b64f0aa5830a14e92f1c6b9cf114b4c088) Merge hr/main into fix-2885-wolfwet ### 📊 Changes **4 files changed** (+229 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+16 -4) 📝 `crates/horizon-client/src/mobs/sync.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/tame.rs` (+208 -20) 📝 `tools/test_mob_ai_parity.py` (+4 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why Part of #2885 ("wolves don't get darker when they are in water" and "wolves don't do the out of water animation"). A wolf's wet and shake state was computed only in `tame::ai_step`, which runs where the AI runs. A client of a server never computed it: `sync::client_tick` had no wolf branch and `sync::entity_event` ignored events 8 and 56, and the server never sent them. That client is the default single player (whose world runs on the server thread) and every LAN guest. So for them a wolf never darkened in water or rain (`Wolf.getWetShade`) and never shook dry. The fix splits the wet and shaking part of `Wolf.tick` into `shake_tick`, which both sides now run: - Server (`server_shake`, called by `ai_step`): `Wolf.aiStep` starts the shake of a wet wolf that is on the ground and not pathing, and broadcasts entity event 8. In water or rain, `Wolf.tick` broadcasts event 56 and cancels the shake. The shake now starts and plays its sound in the same tick, as in vanilla. Before, it started one tick late. - Client (`tame::client_tick`, from the remote mob tick with `Entity.isInRain` at the wolf): the wolf becomes wet on its own in water or rain and runs the shake to the end, then it is dry. It draws the splashes. `tame::entity_event` handles `Wolf.handleEntityEvent` 8 (start) and 56 (cancel). The client plays no shake sound and does not cancel the shake by itself, as in vanilla. - Splash offsets now come from the wolf's own random, as in `Wolf.tick`: `(nextFloat*2-1)*bbWidth*0.5` around x/z, `y+0.8`, with the wolf's motion. The server draws them too, so its random stream stays in step with vanilla. As in vanilla, a wolf standing in the rain gets events 8 and 56 every tick: `aiStep` starts the shake and `tick` cancels it. ## 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 From `javap -c -p` on the 26.3 client jar, `net.minecraft.world.entity.animal.wolf.Wolf`: - `aiStep`: `!isClientSide && isWet && !isShaking && !isPathFinding() && onGround()` sets `isShaking` and resets `shakeAnim`/`shakeAnimO`, then `broadcastEntityEvent(this, 8)`. - `tick`: `isInWaterOrRain()` sets `isWet`. On the server a shaking wolf gets `broadcastEntityEvent(56)` and `cancelShake()`. Otherwise a shaking wolf plays `WOLF_SHAKE` at `shakeAnim == 0`, steps `shakeAnimO = shakeAnim; shakeAnim += 0.05`, dries at `shakeAnimO >= 2`, and past 0.4 adds `(int)(Mth.sin((shakeAnim-0.4)*π)*7)` SPLASH particles at `getX() + (nextFloat*2-1)*getBbWidth()*0.5, y+0.8, …` with `getDeltaMovement()`. - `handleEntityEvent`: 8 starts shaking, 56 calls `cancelShake`. `getWetShade` reads `isWet` and the shake. - `Entity.isInRain` (rain at the block position or at the box top). Checked by: - Unit tests in `mobs::tame::tests`. They cover the client wolf darkening in water and rain, event 8 starting a 41-tick shake that splashes and ends dry with no client sound, event 56 cancelling it, and the server broadcasting 8 and 56. - `tools/test_mob_ai_parity.py`, two new scenarios. `wolf_shake`: a wolf climbs out of a one-block water hole and shakes, which checks the start tick, the sound draws and the splash draws. `wolf_rain`: a wolf in the rain. ## Self-check `tools/pr_ready.py` doesn't run on Windows (it needs SIGHUP), so I ran its steps by hand: - `cargo fmt --all -- --check`: clean - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean - `cargo test -p horizon-client --lib mobs::tame::tests`, with this branch: 3 passed. - The same command with the fix's logic removed (the new hooks emptied, as on main, and `server_shake` holding main's `ai_step` body): 3 failed. - `a_server_tells_the_clients_when_a_wolf_shakes`: `left: [] right: [8]` - `a_wolf_of_a_server_darkens_in_water_and_shakes_dry_on_its_event`: tint `0xFFFFFFFF` (white) instead of `0xFFBFBFBF` ("wet in water") - `a_wolf_of_a_server_stops_shaking_on_its_cancel_event`: `assertion failed: m.anim.v[SHAKE] > 0.4` - `cargo test -p horizon-client --lib mobs::`: 137 passed, 0 failed (rebased on current main) - `cargo test -p horizon-client --bin horizon-client game::remote`: 23 passed (this includes `remote_mob_data`) - `python tools/test_mob_ai_parity.py --only wolf_shake wolf_rain`, with this branch: 2/2 scenarios match entirely, 302/302 mob-ticks. With the existing wolf scenarios (`wolf_hurt`, `wolf_deep_water`, `llama_wolf`) too: 5/5, 1066/1066 mob-ticks. - The same scenarios on main's code: `wolf_shake` first diverges at tick 64. Vanilla plays `entity.wolf.shake` there and Horizon plays nothing (two fewer random draws). - An earlier version of this branch that still used the old splash event diverged at tick 72, where vanilla's `Wolf.tick` draws the splash offsets. That is why the offsets now come from the wolf's random. - `python tools/test_mob_ai_parity.py` (full): 191/193 scenarios. The other two, `creeper_alone` and `breeze_player`, are last-bit float differences that main shows too. In game, on a `--profile fast` build: - Default single player (server thread): a wolf in a 1×1 glass pen is put in a water block, then the water is removed. - LAN guest: the host opens to LAN and a second game joins as `Guest` to watch the same wolf. ## Screenshots ![a wolf leaving water, frame by frame; top: main (no darkening, no shake), bottom: this branch (wet shade, shake with water drops)](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/2885-wolfwet-1.png) Same scene and seed: a wolf in a glass pen is put in water, then the water is removed. Frames are about 0.3 s apart. - Before (nightly 2026-10-29 a305d38): the wolf is just as bright right out of the water as when it is dry, with no shake and no splashes. - After, on the server thread: the wolf comes out grey (0.75 shade). It shakes with the body roll and throws blue splashes. It gets lighter through the shake and is white once dry, about 2 s later. - After, on a LAN guest: the guest sees the same darkening, shake and splashes. 🤖 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:23 +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#5409
No description provided.