[PR #2391] [MERGED] Give foxes their own goals: flee, hunt, nap in the shade and eat berries #4270

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

📋 Pull Request Information

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

Base: main ← Head: fix/fox-behaviour


📝 Commits (2)

  • d248ab2 Give foxes their own goals: flee, hunt, nap in the shade and eat berries
  • 94600b2 Format the fox module order

📊 Changes

8 files changed (+411 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+4 -0)
📝 crates/horizon-client/src/game/lan.rs (+12 -0)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+5 -0)
📝 crates/horizon-client/src/mobs.rs (+1 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+2 -0)
📝 crates/horizon-client/src/mobs/body_anim.rs (+1 -1)
➕ crates/horizon-client/src/mobs/fox.rs (+369 -0)
📝 crates/horizon-client/src/mobs/goals.rs (+17 -0)

📄 Description

What and why

Foxes behaved like generic animals. They panicked at speed 1.25 instead of 2.2, never ran from players, wolves or polar bears, never hunted chickens, rabbits or fish, never bred, never napped and never went for berries.

This adds mobs/fox.rs with the goals from Fox.registerGoals that Horizon can run with its existing goal library:

  • Panic at 2.2, breeding, follow parent, stroll, look at player (24 blocks), leap at target.
  • Avoid players within 16 (not sneaking ones), untamed wolves and polar bears within 8, at 1.6 / 1.4.
  • Hunt: chickens and rabbits, baby turtles on land, schooling fish, with melee attack at 1.2. Red foxes prefer land prey, snow foxes prefer fish (target priorities follow setTargetGoals).
  • Sleep: by day, in the shade, with nobody around (SleepGoal). The fox wakes in water, in a thunderstorm or when it has a target.
  • Eat berries: walk to a ripe sweet berry bush or a glow berry vine and pick it after 40 ticks (respects mob_griefing). A fox with an empty mouth keeps one berry.
  • Eat food held in the mouth after 600 ticks.

The fox flags byte and the variant are now sent to clients (entries 18 and 17), so the sleeping pose shows on the in-process server path and for LAN guests. A baby fox takes either parent's variant.

Not in this PR: stalking and pouncing, faceplant, seeking shelter, picking up items, strolling through villages, perching, and trusting players (needs per-player UUID memory).

Vanilla reference

  • Fox.registerGoals, setTargetGoals, Fox.tick, Fox.aiStep (eating), canEat.
  • Fox.SleepGoal, FoxBehaviorGoal.hasShelter / alertable, FoxAlertableEntitiesSelector.
  • Fox.FoxEatBerriesGoal, CaveVines.use.
  • Fox.getBreedOffspring; flag bits from Fox.DATA_FLAGS_ID.

Self-check

cargo check -p horizon-client passes.


🔄 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/2391 **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:** `fix/fox-behaviour` --- ### 📝 Commits (2) - [`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 ### 📊 Changes **8 files changed** (+411 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+4 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+12 -0) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+5 -0) 📝 `crates/horizon-client/src/mobs.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs/body_anim.rs` (+1 -1) ➕ `crates/horizon-client/src/mobs/fox.rs` (+369 -0) 📝 `crates/horizon-client/src/mobs/goals.rs` (+17 -0) </details> ### 📄 Description ## What and why Foxes behaved like generic animals. They panicked at speed 1.25 instead of 2.2, never ran from players, wolves or polar bears, never hunted chickens, rabbits or fish, never bred, never napped and never went for berries. This adds `mobs/fox.rs` with the goals from `Fox.registerGoals` that Horizon can run with its existing goal library: - Panic at 2.2, breeding, follow parent, stroll, look at player (24 blocks), leap at target. - Avoid players within 16 (not sneaking ones), untamed wolves and polar bears within 8, at 1.6 / 1.4. - Hunt: chickens and rabbits, baby turtles on land, schooling fish, with melee attack at 1.2. Red foxes prefer land prey, snow foxes prefer fish (target priorities follow `setTargetGoals`). - Sleep: by day, in the shade, with nobody around (`SleepGoal`). The fox wakes in water, in a thunderstorm or when it has a target. - Eat berries: walk to a ripe sweet berry bush or a glow berry vine and pick it after 40 ticks (respects `mob_griefing`). A fox with an empty mouth keeps one berry. - Eat food held in the mouth after 600 ticks. The fox flags byte and the variant are now sent to clients (entries 18 and 17), so the sleeping pose shows on the in-process server path and for LAN guests. A baby fox takes either parent's variant. Not in this PR: stalking and pouncing, faceplant, seeking shelter, picking up items, strolling through villages, perching, and trusting players (needs per-player UUID memory). ## Vanilla reference - `Fox.registerGoals`, `setTargetGoals`, `Fox.tick`, `Fox.aiStep` (eating), `canEat`. - `Fox.SleepGoal`, `FoxBehaviorGoal.hasShelter` / `alertable`, `FoxAlertableEntitiesSelector`. - `Fox.FoxEatBerriesGoal`, `CaveVines.use`. - `Fox.getBreedOffspring`; flag bits from `Fox.DATA_FLAGS_ID`. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:15:57 +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#4270
No description provided.