[PR #5423] [CLOSED] fix(mobs): an ocelot can come to trust players #6279

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5423
Author: @sirrayi
Created: 10/31/2026
Status: ❌ Closed

Base: main ← Head: fix/ocelot-trust


📝 Commits (2)

  • 3cc64d9 fix(mobs): an ocelot can come to trust players
  • 1e9cfeb fix(mobs): a wild ocelot despawns, a trusting one stays

📊 Changes

6 files changed (+122 additions, -13 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+8 -0)
📝 crates/horizon-client/src/game/creatures.rs (+21 -0)
📝 crates/horizon-client/src/mobs.rs (+3 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+13 -5)
📝 crates/horizon-client/src/mobs/tame.rs (+75 -6)
📝 tools/port_map/game-011.tsv (+2 -2)

📄 Description

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

What and why

An ocelot can never come to trust a player: Ocelot.Trusting was not modelled at all, so a wild ocelot took the fish someone offered and stayed scared of everyone, and nothing about trust survived a save. This is the Ocelot.mobInteract and Ocelot.reassessTrustingGoals rows of #3512, and the ocelot half of the "fox/ocelot trust parts are welcome as a smaller PR" that you invited when closing #3943.

  • Extra.trusting is Ocelot.DATA_TRUSTING, set through tame::set_trusting.
  • tame::try_trusting is the method's roll: one time in three the ocelot starts to trust. Either way the spawnTrustingParticles arguments are drawn from the ocelot's own random — vanilla runs that even though the server sends nothing — so the draws happen here too.
  • The click is the ocelot's own arm of Game::interact_mob: fish, a player within three blocks, the tempt goal running, and no trust yet. Entity events 41 (hearts) and 40 (smoke) go to the clients; entity_event_burst already knew those for an ocelot.
  • OcelotAvoidEntityGoal refuses a trusting ocelot, which is the effect of vanilla's reassessTrustingGoals taking the goal off — the same shape the fox's avoid goal uses.
  • The save writes and reads Trusting (Ocelot.addAdditionalSaveData / readAdditionalSaveData).
  • Ocelot.removeWhenFarAway: a wild ocelot older than 2400 ticks is removed when it drifts away from every player, and a trusting one is kept like any animal — despawn_check had every animal in the "never removed" set.

Vanilla reference

Ocelot.mobInteract, Ocelot.setTrusting, Ocelot.DATA_TRUSTING, Ocelot.spawnTrustingParticles, Ocelot.reassessTrustingGoals, Ocelot.OcelotAvoidEntityGoal, and Ocelot.addAdditionalSaveData/readAdditionalSaveData.

Test: mobs::tame::trusting_tests::an_ocelot_starts_untrusting_and_the_roll_is_one_in_three — a fresh ocelot trusts nobody, set_trusting both ways, and over 600 seeded rolls about a third come up trusting with the flag following the roll. No prepared game data needed.

What is not in it

  • The synched-data entry for DATA_TRUSTING (index 18): nothing on a client reads it yet, so I left it rather than add a slot nothing consumes.
  • The LoveCause breeding hand-off from #3943 remains open for both the fox and the ocelot.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Other projects' code

none. The shape follows the closed #3943, whose fox/ocelot trust parts the maintainer invited back as a smaller PR; its code is this repository's own.

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 trusting_tests
  an_ocelot_starts_untrusting_and_the_roll_is_one_in_three ... ok
cargo test -p horizon-client --lib entity_nbt
  18 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-011.tsv: Ocelot.mobInteract is port and Ocelot.reassessTrustingGoals is inline now.

🤖 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/5423 **Author:** [@sirrayi](https://github.com/sirrayi) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/ocelot-trust` --- ### 📝 Commits (2) - [`3cc64d9`](https://github.com/horizon-rust/horizon/commit/3cc64d915112a3affa2beb5a2be11cbd6f660742) fix(mobs): an ocelot can come to trust players - [`1e9cfeb`](https://github.com/horizon-rust/horizon/commit/1e9cfebb5a512eb9cbff12d209b19a288c26dfd7) fix(mobs): a wild ocelot despawns, a trusting one stays ### 📊 Changes **6 files changed** (+122 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+8 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+21 -0) 📝 `crates/horizon-client/src/mobs.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+13 -5) 📝 `crates/horizon-client/src/mobs/tame.rs` (+75 -6) 📝 `tools/port_map/game-011.tsv` (+2 -2) </details> ### 📄 Description > 🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi personally. ## What and why An ocelot can never come to trust a player: `Ocelot.Trusting` was not modelled at all, so a wild ocelot took the fish someone offered and stayed scared of everyone, and nothing about trust survived a save. This is the `Ocelot.mobInteract` and `Ocelot.reassessTrustingGoals` rows of #3512, and the ocelot half of the "fox/ocelot trust parts are welcome as a smaller PR" that you invited when closing #3943. - **`Extra.trusting`** is `Ocelot.DATA_TRUSTING`, set through `tame::set_trusting`. - **`tame::try_trusting`** is the method's roll: one time in three the ocelot starts to trust. Either way the `spawnTrustingParticles` arguments are drawn from the ocelot's own random — vanilla runs that even though the server sends nothing — so the draws happen here too. - **The click** is the ocelot's own arm of `Game::interact_mob`: fish, a player within three blocks, the tempt goal running, and no trust yet. Entity events 41 (hearts) and 40 (smoke) go to the clients; `entity_event_burst` already knew those for an ocelot. - **`OcelotAvoidEntityGoal`** refuses a trusting ocelot, which is the effect of vanilla's `reassessTrustingGoals` taking the goal off — the same shape the fox's avoid goal uses. - **The save** writes and reads `Trusting` (`Ocelot.addAdditionalSaveData` / `readAdditionalSaveData`). - **`Ocelot.removeWhenFarAway`**: a wild ocelot older than 2400 ticks is removed when it drifts away from every player, and a trusting one is kept like any animal — `despawn_check` had every animal in the "never removed" set. ## Vanilla reference `Ocelot.mobInteract`, `Ocelot.setTrusting`, `Ocelot.DATA_TRUSTING`, `Ocelot.spawnTrustingParticles`, `Ocelot.reassessTrustingGoals`, `Ocelot.OcelotAvoidEntityGoal`, and `Ocelot.addAdditionalSaveData`/`readAdditionalSaveData`. Test: `mobs::tame::trusting_tests::an_ocelot_starts_untrusting_and_the_roll_is_one_in_three` — a fresh ocelot trusts nobody, `set_trusting` both ways, and over 600 seeded rolls about a third come up trusting with the flag following the roll. No prepared game data needed. ## What is not in it - The synched-data entry for `DATA_TRUSTING` (index 18): nothing on a client reads it yet, so I left it rather than add a slot nothing consumes. - The `LoveCause` breeding hand-off from #3943 remains open for both the fox and the ocelot. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Other projects' code none. The shape follows the closed #3943, whose fox/ocelot trust parts the maintainer invited back as a smaller PR; its code is this repository's own. ## 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 trusting_tests an_ocelot_starts_untrusting_and_the_roll_is_one_in_three ... ok cargo test -p horizon-client --lib entity_nbt 18 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-011.tsv`: `Ocelot.mobInteract` is `port` and `Ocelot.reassessTrustingGoals` is `inline` now. 🤖 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:36 +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#6279
No description provided.