[PR #5430] [MERGED] An ocelot trusts the player who feeds it raw fish #6284

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5430
Author: @xFedeT
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/ocelot-trust


📝 Commits (1)

  • 0dfe43e An ocelot trusts the player who feeds it raw fish, one time in three

📊 Changes

8 files changed (+123 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+38 -0)
📝 crates/horizon-client/src/game/creatures.rs (+34 -0)
📝 crates/horizon-client/src/game/lan.rs (+7 -0)
📝 crates/horizon-client/src/game/remote.rs (+1 -1)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+15 -0)
📝 crates/horizon-client/src/mobs.rs (+2 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+3 -1)
📝 crates/horizon-client/src/mobs/tame.rs (+23 -8)

📄 Description

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

Part of #3512: the Ocelot.mobInteract row, and the trust half of Ocelot.registerGoals / reassessTrustingGoals / OcelotAvoidEntityGoal.canUse / OcelotTemptGoal.canScare. The comment in tame.rs said trust was "not ported yet": every ocelot was wild forever. (kacpherek's #3943, which had it, was closed without a merge.)

Vanilla (Ocelot.java)

  • DATA_TRUSTING (synched, saved as Trusting).
  • mobInteract: while the tempt goal runs, for a player holding ocelot food within 3 blocks (distanceToSqr < 9) and an ocelot that is not trusting: the item is used up (usePlayerItem); on the server random.nextInt(3) == 0 sets trusting and broadcasts entity event 41 (hearts), otherwise event 40 (smoke); SUCCESS. Anything else is Animal.mobInteract (breeding).
  • OcelotAvoidEntityGoal.canUse and canContinueToUse are !isTrusting() && super; OcelotTemptGoal.canScare is super.canScare() && !isTrusting().
  • removeWhenFarAway: !isTrusting() && tickCount > 2400 (an Animal otherwise never despawns).

What changes

  • Extra.trusting, saved and loaded as Trusting, synched as data 18 (after AgeableMob's two) and read by clients.
  • Game::interact_mob: the trust roll with the mob's own random, the item used up, hearts (41) or smoke (40) sent as entity events (the clients' bursts already existed in entity_event_burst; the event handler now lists 40 and 41).
  • A trusting ocelot's avoid goal and tempt scare are off (tame.rs), and check_despawn follows Ocelot.removeWhenFarAway.

Verification

  • an_ocelot_keeps_its_trust (NBT) and an_ocelot_takes_its_trusting_flag (client data).
  • A real run on the server thread (survival, raw cod, a wild ocelot 2 blocks away, one interact each): the fish is used up each time and the clients show the hearts or the smoke.

an ocelot that trusted the player

  • pr_ready --quick: rustfmt, clippy and the Python tests pass. The only failure is title::tests::title_screen_keyboard_navigation_and_activation, which fails the same way on a clean origin/main here (and the 8 lan_bot tests did before).

🤖 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/5430 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/ocelot-trust` --- ### 📝 Commits (1) - [`0dfe43e`](https://github.com/horizon-rust/horizon/commit/0dfe43ea45e9c3ea22469ceef7b540fd5220c66e) An ocelot trusts the player who feeds it raw fish, one time in three ### 📊 Changes **8 files changed** (+123 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+38 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+34 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+7 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+1 -1) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+15 -0) 📝 `crates/horizon-client/src/mobs.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+3 -1) 📝 `crates/horizon-client/src/mobs/tame.rs` (+23 -8) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Part of #3512: the `Ocelot.mobInteract` row, and the trust half of `Ocelot.registerGoals` / `reassessTrustingGoals` / `OcelotAvoidEntityGoal.canUse` / `OcelotTemptGoal.canScare`. The comment in `tame.rs` said trust was "not ported yet": every ocelot was wild forever. (`kacpherek`'s #3943, which had it, was closed without a merge.) ## Vanilla (`Ocelot.java`) - `DATA_TRUSTING` (synched, saved as `Trusting`). - `mobInteract`: while the tempt goal runs, for a player holding ocelot food within 3 blocks (`distanceToSqr < 9`) and an ocelot that is not trusting: the item is used up (`usePlayerItem`); on the server `random.nextInt(3) == 0` sets trusting and broadcasts entity event 41 (hearts), otherwise event 40 (smoke); SUCCESS. Anything else is `Animal.mobInteract` (breeding). - `OcelotAvoidEntityGoal.canUse` and `canContinueToUse` are `!isTrusting() && super`; `OcelotTemptGoal.canScare` is `super.canScare() && !isTrusting()`. - `removeWhenFarAway`: `!isTrusting() && tickCount > 2400` (an `Animal` otherwise never despawns). ## What changes - `Extra.trusting`, saved and loaded as `Trusting`, synched as data 18 (after `AgeableMob`'s two) and read by clients. - `Game::interact_mob`: the trust roll with the mob's own random, the item used up, hearts (41) or smoke (40) sent as entity events (the clients' bursts already existed in `entity_event_burst`; the event handler now lists 40 and 41). - A trusting ocelot's avoid goal and tempt scare are off (`tame.rs`), and `check_despawn` follows `Ocelot.removeWhenFarAway`. ## Verification - `an_ocelot_keeps_its_trust` (NBT) and `an_ocelot_takes_its_trusting_flag` (client data). - A real run on the server thread (survival, raw cod, a wild ocelot 2 blocks away, one interact each): the fish is used up each time and the clients show the hearts or the smoke. ![an ocelot that trusted the player](https://raw.githubusercontent.com/xFedeT/horizon/pr-screenshots/3512/ocelot-trust.png) - `pr_ready --quick`: rustfmt, clippy and the Python tests pass. The only failure is `title::tests::title_screen_keyboard_navigation_and_activation`, which fails the same way on a clean `origin/main` here (and the 8 `lan_bot` tests did before). 🤖 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 06:17:44 +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#6284
No description provided.