[PR #3336] [MERGED] Rabbits and wild ocelots run from players #4912

Closed
opened 2026-11-03 05:08:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3336
Author: @matyden
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: mobs/rabbit-ocelot-avoid-player


📝 Commits (3)

  • 8170b87 Rabbits and wild ocelots run from players
  • 0dea3a8 Merge remote-tracking branch 'hr/main' into pr-3336
  • 8040587 Cats and ocelots sprint when they dash

📊 Changes

10 files changed (+260 additions, -27 deletions)

View changed files

📝 crates/horizon-client/src/game/lan.rs (+5 -3)
📝 crates/horizon-client/src/game/lan_attributes.rs (+16 -0)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+2 -0)
📝 crates/horizon-client/src/mobs.rs (+7 -1)
📝 crates/horizon-client/src/mobs/ai.rs (+15 -6)
📝 crates/horizon-client/src/mobs/living.rs (+16 -5)
📝 crates/horizon-client/src/mobs/rabbit.rs (+80 -6)
📝 crates/horizon-client/src/mobs/sync.rs (+2 -1)
📝 crates/horizon-client/src/mobs/tame.rs (+107 -5)
📝 tools/test_mob_ai_parity.py (+10 -0)

📄 Description

🤖 Opened by matyden's AI agent (Claude Code), not by matyden.

What and why

Rabbits and ocelots don't run from players (#2780). Rabbits used the generic fallback goals plus Breed and Tempt, with no avoid goals; ocelots had no goals of their own at all.

  • Rabbit: rabbit::register now registers vanilla's list in vanilla's order: Float, Panic (2.2), Breed, Tempt, three RabbitAvoidEntityGoals (players within 8 blocks, wolves within 10, monsters within 4, all at 2.2/2.2, never for the killer bunny), Stroll avoiding water (0.6) and LookAtPlayer. The generic list's rabbit special cases in ai::generic are gone.
  • Ocelot: new tame::register_ocelot, following Ocelot.registerGoals and then reassessTrustingGoals: Float, OcelotTemptGoal (0.6, scared by moving players), LeapAtTarget, OcelotAttackGoal, Breed, Stroll (0.8, 1.0000001E-5), LookAtPlayer, and OcelotAvoidEntityGoal last (players within 16 blocks, 0.8/1.33). Targets: chickens and baby turtles on land.

Not ported yet, and named in the code: the rabbit's ClimbOnTopOfPowderSnowGoal and RaidGardenGoal, and ocelot trust (mobInteract, the Trusting tag), so every ocelot is wild for now.

Refs #2780

Vanilla reference

Read from the 26.3 client jar (javap -c -p):

  • Rabbit.registerGoals, Rabbit$RabbitAvoidEntityGoal
  • Ocelot.registerGoals, Ocelot.reassessTrustingGoals, Ocelot$OcelotAvoidEntityGoal, Ocelot$OcelotTemptGoal
  • AvoidEntityGoal (already ported as goals::AvoidEntity)

Distances match the Minecraft Wiki (rabbits flee players within 8 blocks, wolves within 10, hostile mobs within 4; wild ocelots flee players within 16).

Harness: tools/test_mob_ai_parity.py gains five ocelot scenarios (ocelot_alone, ocelot_player, ocelot_player_far, ocelot_creative, ocelot_tempted). They were not run here: this machine has no prepared vanilla data, so they need the run-parity label. No rabbit scenarios yet: RaidGardenGoal's first canUse draws from the rabbit's random, so a rabbit trace can't match until it's ported. A unit test checks the rabbit's goal list.

Self-check

pr_ready (tools/pr_ready.py --quick on WIN-TU836SRDD9A, against origin/main at cba52f4e5, 4 min 22 s)

Check Result
Scope ✅ 4 files, +185 −12
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 401 run, FAILED (failures=2, errors=8, skipped=11) (1 min 4 s)
rustfmt ✅ (12 s)
clippy ✅ (1 min 46 s)
tests: horizon-client ❌ 1092 passed, 3 failed (1 min 1 s)
doc tests ✅ 0 passed (16 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Run on Windows. The ❌ rows fail the same way on unmodified main on this machine, and none touch mobs: the Python failures are path separators, files read in the Windows code page (cp1251) instead of UTF-8 and symlinks needing Developer Mode; the three horizon-client failures are crash::tests::stacks_start_at_the_panicking_frame (backslash paths), save::tests::session_lock_is_exclusive (Windows file locks) and telemetry::tests::a_crash_keeps_only_what_says_what_happened (the Windows user here is literally named user). Running the lib tests in parallel sometimes also ends in STATUS_HEAP_CORRUPTION, on main too. cargo test -p horizon-client --lib mobs:: passes (104 tests); fmt and clippy -D warnings (with --features horizon-client/mods and --no-default-features) are clean.

🤖 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/3336 **Author:** [@matyden](https://github.com/matyden) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `mobs/rabbit-ocelot-avoid-player` --- ### 📝 Commits (3) - [`8170b87`](https://github.com/horizon-rust/horizon/commit/8170b8742baaa0ae03d3ce62d31279380204fe57) Rabbits and wild ocelots run from players - [`0dea3a8`](https://github.com/horizon-rust/horizon/commit/0dea3a89e23981914b557207206aded2008fc9ec) Merge remote-tracking branch 'hr/main' into pr-3336 - [`8040587`](https://github.com/horizon-rust/horizon/commit/80405878b5b5bac544e96fac3bbaabebaf38d8e4) Cats and ocelots sprint when they dash ### 📊 Changes **10 files changed** (+260 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan.rs` (+5 -3) 📝 `crates/horizon-client/src/game/lan_attributes.rs` (+16 -0) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs.rs` (+7 -1) 📝 `crates/horizon-client/src/mobs/ai.rs` (+15 -6) 📝 `crates/horizon-client/src/mobs/living.rs` (+16 -5) 📝 `crates/horizon-client/src/mobs/rabbit.rs` (+80 -6) 📝 `crates/horizon-client/src/mobs/sync.rs` (+2 -1) 📝 `crates/horizon-client/src/mobs/tame.rs` (+107 -5) 📝 `tools/test_mob_ai_parity.py` (+10 -0) </details> ### 📄 Description > 🤖 Opened by matyden's AI agent (Claude Code), not by matyden. ## What and why Rabbits and ocelots don't run from players (#2780). Rabbits used the generic fallback goals plus Breed and Tempt, with no avoid goals; ocelots had no goals of their own at all. - **Rabbit**: `rabbit::register` now registers vanilla's list in vanilla's order: Float, Panic (2.2), Breed, Tempt, three `RabbitAvoidEntityGoal`s (players within 8 blocks, wolves within 10, monsters within 4, all at 2.2/2.2, never for the killer bunny), Stroll avoiding water (0.6) and LookAtPlayer. The generic list's rabbit special cases in `ai::generic` are gone. - **Ocelot**: new `tame::register_ocelot`, following `Ocelot.registerGoals` and then `reassessTrustingGoals`: Float, `OcelotTemptGoal` (0.6, scared by moving players), LeapAtTarget, `OcelotAttackGoal`, Breed, Stroll (0.8, 1.0000001E-5), LookAtPlayer, and `OcelotAvoidEntityGoal` last (players within 16 blocks, 0.8/1.33). Targets: chickens and baby turtles on land. Not ported yet, and named in the code: the rabbit's `ClimbOnTopOfPowderSnowGoal` and `RaidGardenGoal`, and ocelot trust (`mobInteract`, the `Trusting` tag), so every ocelot is wild for now. Refs #2780 ## Vanilla reference Read from the 26.3 client jar (`javap -c -p`): - `Rabbit.registerGoals`, `Rabbit$RabbitAvoidEntityGoal` - `Ocelot.registerGoals`, `Ocelot.reassessTrustingGoals`, `Ocelot$OcelotAvoidEntityGoal`, `Ocelot$OcelotTemptGoal` - `AvoidEntityGoal` (already ported as `goals::AvoidEntity`) Distances match the Minecraft Wiki (rabbits flee players within 8 blocks, wolves within 10, hostile mobs within 4; wild ocelots flee players within 16). Harness: `tools/test_mob_ai_parity.py` gains five ocelot scenarios (`ocelot_alone`, `ocelot_player`, `ocelot_player_far`, `ocelot_creative`, `ocelot_tempted`). They were **not run here**: this machine has no prepared vanilla data, so they need the `run-parity` label. No rabbit scenarios yet: `RaidGardenGoal`'s first `canUse` draws from the rabbit's random, so a rabbit trace can't match until it's ported. A unit test checks the rabbit's goal list. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on WIN-TU836SRDD9A, against origin/main at cba52f4e5, 4 min 22 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +185 −12 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 401 run, FAILED (failures=2, errors=8, skipped=11) (1 min 4 s) | | rustfmt | ✅ (12 s) | | clippy | ✅ (1 min 46 s) | | tests: horizon-client | ❌ 1092 passed, 3 failed (1 min 1 s) | | doc tests | ✅ 0 passed (16 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Run on Windows. The ❌ rows fail the same way on unmodified `main` on this machine, and none touch mobs: the Python failures are path separators, files read in the Windows code page (cp1251) instead of UTF-8 and symlinks needing Developer Mode; the three `horizon-client` failures are `crash::tests::stacks_start_at_the_panicking_frame` (backslash paths), `save::tests::session_lock_is_exclusive` (Windows file locks) and `telemetry::tests::a_crash_keeps_only_what_says_what_happened` (the Windows user here is literally named `user`). Running the lib tests in parallel sometimes also ends in `STATUS_HEAP_CORRUPTION`, on `main` too. `cargo test -p horizon-client --lib mobs::` passes (104 tests); fmt and clippy `-D warnings` (with `--features horizon-client/mods` and `--no-default-features`) are clean. 🤖 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 05:08:52 +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#4912
No description provided.