[PR #2538] [MERGED] Give foxes stalk, pounce, faceplant, shelter and perch states #4408

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

📋 Pull Request Information

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

Base: main ← Head: feat/fox-states


📝 Commits (10+)

  • d248ab2 Give foxes their own goals: flee, hunt, nap in the shade and eat berries
  • 94600b2 Format the fox module order
  • 57e8de0 Send the drowning entity event (67) and draw the bubbles on clients
  • 6887331 Freeze mobs in powder snow and shake frozen mobs and cold striders
  • a45d0de Server-thread clients animate warden, sniffer, breeze, camel and shulker
  • 25c53cc Server-thread clients animate ravager, hoglin, iron golem, creaking, vex, allay, axolotl, guardian, copper golem and strider
  • 11e1ff1 Let armadillos roll up when scared, peek out and take less damage as a ball
  • 8144385 Give foxes their stalk, pounce, faceplant, shelter and perch states
  • 29754b8 Merge origin/main into feat/fox-states
  • 5e27fd3 Use the mob level event that main already has

📊 Changes

36 files changed (+3144 additions, -128 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+5 -18)
📝 crates/horizon-client/src/game/combat.rs (+42 -1)
📝 crates/horizon-client/src/game/commands/world_cmds.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+32 -0)
📝 crates/horizon-client/src/game/lan.rs (+175 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+9 -0)
📝 crates/horizon-client/src/game/lan_mobs.rs (+6 -0)
📝 crates/horizon-client/src/game/remote.rs (+68 -0)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+59 -1)
📝 crates/horizon-client/src/mobs.rs (+58 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+80 -14)
📝 crates/horizon-client/src/mobs/allay.rs (+5 -0)
➕ crates/horizon-client/src/mobs/armadillo.rs (+407 -0)
📝 crates/horizon-client/src/mobs/body_anim.rs (+6 -6)
📝 crates/horizon-client/src/mobs/breeze.rs (+22 -0)
📝 crates/horizon-client/src/mobs/camel.rs (+45 -4)
📝 crates/horizon-client/src/mobs/control.rs (+11 -1)
📝 crates/horizon-client/src/mobs/copper_golem.rs (+12 -2)
📝 crates/horizon-client/src/mobs/creaking.rs (+49 -21)

...and 16 more files

📄 Description

What and why

Foxes only ever set the sleeping flag. The model call always got false for crouching, pouncing, sitting and faceplanted, and nothing animated the head tilt or the crouch. This adds the rest of the fox's behaviour states, synced to clients and drawn on them.

This is built on top of #2391 (the branch contains its two commits, plus a merge of main that fixes a one-line conflict in ai.rs). Merge #2391 first, or take this one together with it.

Added:

  • Stalk and pounce: a fox with a chicken or rabbit as its target creeps up to 6 blocks, crouches, then leaps at it with the body tilting along the flight, biting when within 2 blocks.
  • Faceplant: if the leap misses and the fox lands on a snow layer, it stays put for 40 ticks with its nose down and snow crumbs flying.
  • Seek shelter and perch (sit down and look around two to four times).
  • The fox's own conditions on the shared goals (melee attack, look at player), and clearStates when float, breed, follow parent and shelter start. A sleeping, sitting or faceplanted fox no longer moves, and a sleeping fox no longer turns its head.
  • Client side: the head tilt (interested) and the crouch ease in and out from the synched flags, so LAN guests and the single player window see them. The body tilts for pounce and faceplant, and the sleeping, snow and baby textures are used (baby foxes also get the baby model now).

Not in this PR: picking up items, strolling through villages, trusting players and defending them (the trust list needs per-player memory), and the village check in seek shelter (vanilla foxes do not seek shelter inside a village).

Vanilla reference

  • Fox.StalkPreyGoal, FoxPounceGoal, FaceplantGoal, SeekShelterGoal, PerchAndSearchGoal, isPathClear.
  • Fox.tick (interested angle, crouch amount, faceplant crumbs), getHeadRollAngle, getCrouchAmount, isFullyCrouched.
  • FoxMoveControl, FoxLookControl.resetXRotOnTick, FoxMeleeAttackGoal.canUse, FoxLookAtPlayerGoal, FoxFloatGoal, FoxFollowParentGoal, FoxBreedGoal.
  • FleeSunGoal.getHidePos shared by shelter seeking and burning mobs.
  • FoxRenderer.setupRotations, getTextureLocation, FoxModel.setupAnim.

Self-check

cargo check -p horizon-client passes, and so does cargo clippy -p horizon-client --all-targets -- -D warnings.

In game (single player, the window as a client of the in-process server): a fox crept up on a chicken, stopped about 5 blocks away, crouched for about a second, leapt with its body tilted and killed it. With the chicken pulled away mid-leap over snow layers, the fox landed with the faceplant tilt and snow crumbs (the tilt eases out after a couple of ticks, because the look control still turns toward the old target, as in the vanilla code). In a roofed grass room by day a fox slept curled up with the sleeping texture, and idle foxes sat down and looked around. Not tried: a LAN guest, --in-frame, and a snow fox (/summon does not set the fox type here, so the snow texture names are untested).


🔄 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/2538 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/fox-states` --- ### 📝 Commits (10+) - [`d248ab2`](https://github.com/horizon-rust/horizon/commit/d248ab26057306cdca68f68541a5af915e1edf11) Give foxes their own goals: flee, hunt, nap in the shade and eat berries - [`94600b2`](https://github.com/horizon-rust/horizon/commit/94600b266f46779b592f5441d1f2549cf51b27cb) Format the fox module order - [`57e8de0`](https://github.com/horizon-rust/horizon/commit/57e8de0007d63eee598d96c3f9a305659f39327d) Send the drowning entity event (67) and draw the bubbles on clients - [`6887331`](https://github.com/horizon-rust/horizon/commit/688733132d7e105312337bb21cf8a96ee441ba33) Freeze mobs in powder snow and shake frozen mobs and cold striders - [`a45d0de`](https://github.com/horizon-rust/horizon/commit/a45d0de43eef252c6c0b45fad21e2e1bf70bf7bb) Server-thread clients animate warden, sniffer, breeze, camel and shulker - [`25c53cc`](https://github.com/horizon-rust/horizon/commit/25c53cc80330575cf822d2718ca9a0c4afbc3587) Server-thread clients animate ravager, hoglin, iron golem, creaking, vex, allay, axolotl, guardian, copper golem and strider - [`11e1ff1`](https://github.com/horizon-rust/horizon/commit/11e1ff12d0c516f3300c7919babfd4f66fc15131) Let armadillos roll up when scared, peek out and take less damage as a ball - [`8144385`](https://github.com/horizon-rust/horizon/commit/8144385ce6e352754002857f970c988ae5b46e6d) Give foxes their stalk, pounce, faceplant, shelter and perch states - [`29754b8`](https://github.com/horizon-rust/horizon/commit/29754b857d3f5a2b8c464b96a00b7d40dd0c82de) Merge origin/main into feat/fox-states - [`5e27fd3`](https://github.com/horizon-rust/horizon/commit/5e27fd342166040e1cc464e88c059e078534f86a) Use the mob level event that main already has ### 📊 Changes **36 files changed** (+3144 additions, -128 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+5 -18) 📝 `crates/horizon-client/src/game/combat.rs` (+42 -1) 📝 `crates/horizon-client/src/game/commands/world_cmds.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+32 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+175 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+9 -0) 📝 `crates/horizon-client/src/game/lan_mobs.rs` (+6 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+68 -0) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+59 -1) 📝 `crates/horizon-client/src/mobs.rs` (+58 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+80 -14) 📝 `crates/horizon-client/src/mobs/allay.rs` (+5 -0) ➕ `crates/horizon-client/src/mobs/armadillo.rs` (+407 -0) 📝 `crates/horizon-client/src/mobs/body_anim.rs` (+6 -6) 📝 `crates/horizon-client/src/mobs/breeze.rs` (+22 -0) 📝 `crates/horizon-client/src/mobs/camel.rs` (+45 -4) 📝 `crates/horizon-client/src/mobs/control.rs` (+11 -1) 📝 `crates/horizon-client/src/mobs/copper_golem.rs` (+12 -2) 📝 `crates/horizon-client/src/mobs/creaking.rs` (+49 -21) _...and 16 more files_ </details> ### 📄 Description ## What and why Foxes only ever set the sleeping flag. The model call always got `false` for crouching, pouncing, sitting and faceplanted, and nothing animated the head tilt or the crouch. This adds the rest of the fox's behaviour states, synced to clients and drawn on them. This is built on top of #2391 (the branch contains its two commits, plus a merge of `main` that fixes a one-line conflict in `ai.rs`). Merge #2391 first, or take this one together with it. Added: - Stalk and pounce: a fox with a chicken or rabbit as its target creeps up to 6 blocks, crouches, then leaps at it with the body tilting along the flight, biting when within 2 blocks. - Faceplant: if the leap misses and the fox lands on a snow layer, it stays put for 40 ticks with its nose down and snow crumbs flying. - Seek shelter and perch (sit down and look around two to four times). - The fox's own conditions on the shared goals (melee attack, look at player), and `clearStates` when float, breed, follow parent and shelter start. A sleeping, sitting or faceplanted fox no longer moves, and a sleeping fox no longer turns its head. - Client side: the head tilt (interested) and the crouch ease in and out from the synched flags, so LAN guests and the single player window see them. The body tilts for pounce and faceplant, and the sleeping, snow and baby textures are used (baby foxes also get the baby model now). Not in this PR: picking up items, strolling through villages, trusting players and defending them (the trust list needs per-player memory), and the village check in seek shelter (vanilla foxes do not seek shelter inside a village). ## Vanilla reference - `Fox.StalkPreyGoal`, `FoxPounceGoal`, `FaceplantGoal`, `SeekShelterGoal`, `PerchAndSearchGoal`, `isPathClear`. - `Fox.tick` (interested angle, crouch amount, faceplant crumbs), `getHeadRollAngle`, `getCrouchAmount`, `isFullyCrouched`. - `FoxMoveControl`, `FoxLookControl.resetXRotOnTick`, `FoxMeleeAttackGoal.canUse`, `FoxLookAtPlayerGoal`, `FoxFloatGoal`, `FoxFollowParentGoal`, `FoxBreedGoal`. - `FleeSunGoal.getHidePos` shared by shelter seeking and burning mobs. - `FoxRenderer.setupRotations`, `getTextureLocation`, `FoxModel.setupAnim`. ## Self-check `cargo check -p horizon-client` passes, and so does `cargo clippy -p horizon-client --all-targets -- -D warnings`. In game (single player, the window as a client of the in-process server): a fox crept up on a chicken, stopped about 5 blocks away, crouched for about a second, leapt with its body tilted and killed it. With the chicken pulled away mid-leap over snow layers, the fox landed with the faceplant tilt and snow crumbs (the tilt eases out after a couple of ticks, because the look control still turns toward the old target, as in the vanilla code). In a roofed grass room by day a fox slept curled up with the sleeping texture, and idle foxes sat down and looked around. Not tried: a LAN guest, `--in-frame`, and a snow fox (`/summon` does not set the fox type here, so the snow texture names are untested). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:16: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#4408
No description provided.