[PR #5414] [MERGED] fix(mobs): foxes trust the players their list names, and their babies trust the breeders #6273

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5414
Author: @sirrayi
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/fox-trust


📝 Commits (5)

  • c5f11d1 fix(mobs): foxes trust the players their list names
  • e8a93aa fix(mobs): a fox's baby trusts the players who bred it
  • 7170948 test(probe): the mob probe feeds without a love cause
  • 5c3017a fix(mobs): a fox egg's trust goes to the baby made on a fox, not to an egg used on a block
  • 28bd35e Merge main into #5414

📊 Changes

8 files changed (+169 additions, -12 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+1 -1)
📝 crates/horizon-client/src/entity_nbt.rs (+26 -1)
📝 crates/horizon-client/src/game/creatures.rs (+19 -1)
📝 crates/horizon-client/src/mobs.rs (+6 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+4 -1)
📝 crates/horizon-client/src/mobs/fox.rs (+106 -1)
📝 crates/horizon-client/src/mobs/goals.rs (+3 -3)
📝 tools/port_map/game-012.tsv (+4 -4)

📄 Description

🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi personally.

What and why

Foxes have no trusted players: the save wrote an empty Trusted list, nothing read it back, and the avoid-player goal had no trust test — so a fox fled the player who spawned it, and nobody could ever become trusted. That is the Fox.addTrustedEntity and Fox.getTrustedEntities rows of #3512, and it is the "fox/ocelot trust part as a smaller PR on top of mob_looting.rs, with tests" that you asked for when closing #3943.

What is in it:

  • Extra.trusted: [Option<[i32; 4]>; 2] — the two Fox.DATA_TRUSTED_ID_0/_1 slots.
  • The entity's own methods, by name in mobs/fox.rs: trusted_entities (Fox.getTrustedEntities), add_trusted_entity (Fox.addTrustedEntity: the first free slot, and once both are taken a new player replaces the second), clear_trusted (Fox.clearTrusted) and trusts (Fox.trusts).
  • The save: Fox.TRUSTED_LIST_CODEC — a list of int arrays — is written from the list and mob_from_nbt clears and rebuilds it, as Fox.readAdditionalSaveData does.
  • The behaviour the row described: AVOID_PLAYERS no longer flees a player the fox trusts. AvoidEntity::player_when now takes the avoider as well as the player, which is the only signature change; the one existing caller (the fox) is updated with it.
  • Fox.onOffspringSpawnedFromEgg: a fox from a spawn egg trusts the player who used it (game/creatures.rs::use_spawn_egg).
  • Fox.FoxBreedGoal.breed: the baby trusts the players who fed its parents into love. That needed the cause the animals never kept, so Animal.LoveCause is now Extra.love_cause, set from the player handing over the food, saved and read like vanilla's.

Vanilla reference

Fox.getTrustedEntities, Fox.addTrustedEntity, Fox.clearTrusted, Fox.trusts, Fox.addAdditionalSaveData/readAdditionalSaveData (Trusted, TRUSTED_LIST_CODEC), Fox.onOffspringSpawnedFromEgg, and the AVOID_PLAYERS predicate.

Test: mobs::fox::trust_tests::a_fox_trusts_two_players_and_the_third_replaces_the_second — the slot order, the replacement of the second, trusts, and clear_trusted. It needs no prepared game data.

What is not in it

DefendTrustedTargetGoal (a fox defending a trusted player) is a goal of its own and is not here; the ocelot's Trusting flag lives in its own pull request (#5423). Both are named in the map notes.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Other projects' code

none. The shape follows the closed #3943, which was never merged; its fox/ocelot trust and dolphin parts were invited back as a smaller PR.

Self-check

cargo fmt --all --check                                      clean
cargo clippy -p horizon-client --lib --bins --tests -- -D warnings
  Finished (no warnings)
cargo test -p horizon-client --lib mobs::fox
  a_fox_trusts_two_players_and_the_third_replaces_the_second ... ok
  a_baby_fox_trusts_both_players_who_fed_its_parents ... ok
cargo test -p horizon-client --lib entity_nbt
  19 passed, 0 failed
python3 tools/check_public_tree.py
  Public tree check passed.

tools/pr_ready.py still cannot run here (Python 3.11+ needed, 3.9 installed) — the block above is its Rust half.

tools/port_map/game-012.tsv: both Fox rows are port now, with what remains in their notes.

🤖 Generated with DeepSeek Harness (deepseek-v4.1-flash)


🔄 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/5414 **Author:** [@sirrayi](https://github.com/sirrayi) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/fox-trust` --- ### 📝 Commits (5) - [`c5f11d1`](https://github.com/horizon-rust/horizon/commit/c5f11d1eb61bbe2d4d63bec26708a00a231eae81) fix(mobs): foxes trust the players their list names - [`e8a93aa`](https://github.com/horizon-rust/horizon/commit/e8a93aa87ebd823361d571b900b703a480c021e3) fix(mobs): a fox's baby trusts the players who bred it - [`7170948`](https://github.com/horizon-rust/horizon/commit/7170948484cc62d211b29b3c16dabc3c6f3a7887) test(probe): the mob probe feeds without a love cause - [`5c3017a`](https://github.com/horizon-rust/horizon/commit/5c3017a630ec76613919b8cd47de38182c08bffa) fix(mobs): a fox egg's trust goes to the baby made on a fox, not to an egg used on a block - [`28bd35e`](https://github.com/horizon-rust/horizon/commit/28bd35e2868fd37085c77c3ab648613e71d67584) Merge main into #5414 ### 📊 Changes **8 files changed** (+169 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+1 -1) 📝 `crates/horizon-client/src/entity_nbt.rs` (+26 -1) 📝 `crates/horizon-client/src/game/creatures.rs` (+19 -1) 📝 `crates/horizon-client/src/mobs.rs` (+6 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+4 -1) 📝 `crates/horizon-client/src/mobs/fox.rs` (+106 -1) 📝 `crates/horizon-client/src/mobs/goals.rs` (+3 -3) 📝 `tools/port_map/game-012.tsv` (+4 -4) </details> ### 📄 Description > 🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi personally. ## What and why Foxes have no trusted players: the save wrote an empty `Trusted` list, nothing read it back, and the avoid-player goal had no trust test — so a fox fled the player who spawned it, and nobody could ever become trusted. That is the `Fox.addTrustedEntity` and `Fox.getTrustedEntities` rows of #3512, and it is the "fox/ocelot trust part as a smaller PR on top of `mob_looting.rs`, with tests" that you asked for when closing #3943. What is in it: - **`Extra.trusted: [Option<[i32; 4]>; 2]`** — the two `Fox.DATA_TRUSTED_ID_0/_1` slots. - **The entity's own methods, by name** in `mobs/fox.rs`: `trusted_entities` (`Fox.getTrustedEntities`), `add_trusted_entity` (`Fox.addTrustedEntity`: the first free slot, and once both are taken a new player replaces the second), `clear_trusted` (`Fox.clearTrusted`) and `trusts` (`Fox.trusts`). - **The save**: `Fox.TRUSTED_LIST_CODEC` — a list of int arrays — is written from the list and `mob_from_nbt` clears and rebuilds it, as `Fox.readAdditionalSaveData` does. - **The behaviour the row described**: `AVOID_PLAYERS` no longer flees a player the fox trusts. `AvoidEntity::player_when` now takes the avoider as well as the player, which is the only signature change; the one existing caller (the fox) is updated with it. - **`Fox.onOffspringSpawnedFromEgg`**: a fox from a spawn egg trusts the player who used it (`game/creatures.rs::use_spawn_egg`). - **`Fox.FoxBreedGoal.breed`**: the baby trusts the players who fed its parents into love. That needed the cause the animals never kept, so `Animal.LoveCause` is now `Extra.love_cause`, set from the player handing over the food, saved and read like vanilla's. ## Vanilla reference `Fox.getTrustedEntities`, `Fox.addTrustedEntity`, `Fox.clearTrusted`, `Fox.trusts`, `Fox.addAdditionalSaveData`/`readAdditionalSaveData` (`Trusted`, `TRUSTED_LIST_CODEC`), `Fox.onOffspringSpawnedFromEgg`, and the `AVOID_PLAYERS` predicate. Test: `mobs::fox::trust_tests::a_fox_trusts_two_players_and_the_third_replaces_the_second` — the slot order, the replacement of the second, `trusts`, and `clear_trusted`. It needs no prepared game data. ## What is not in it **`DefendTrustedTargetGoal`** (a fox defending a trusted player) is a goal of its own and is not here; the ocelot's `Trusting` flag lives in its own pull request (#5423). Both are named in the map notes. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Other projects' code none. The shape follows the closed #3943, which was never merged; its fox/ocelot trust and dolphin parts were invited back as a smaller PR. ## Self-check ``` cargo fmt --all --check clean cargo clippy -p horizon-client --lib --bins --tests -- -D warnings Finished (no warnings) cargo test -p horizon-client --lib mobs::fox a_fox_trusts_two_players_and_the_third_replaces_the_second ... ok a_baby_fox_trusts_both_players_who_fed_its_parents ... ok cargo test -p horizon-client --lib entity_nbt 19 passed, 0 failed python3 tools/check_public_tree.py Public tree check passed. ``` `tools/pr_ready.py` still cannot run here (Python 3.11+ needed, 3.9 installed) — the block above is its Rust half. `tools/port_map/game-012.tsv`: both `Fox` rows are `port` now, with what remains in their notes. 🤖 Generated with [DeepSeek Harness](https://www.deepseek.com) (deepseek-v4.1-flash) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:17:12 +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#6273
No description provided.