[PR #2720] [MERGED] Untamed horses rear at a held item instead of taking the rider #4563

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2720
Author: @ASOwnerYT
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: claude/2697-horse-make-mad-4431aa


📝 Commits (4)

  • 1758b14 Untamed horses rear at a held item instead of taking the rider (#2697)
  • dae67a8 Merge remote-tracking branch 'upstream/main' into claude/2697-horse-make-mad-4431aa
  • e36a480 Merge remote-tracking branch 'upstream/main' into claude/2697-horse-make-mad-4431aa
  • 1fa4a78 Merge branch 'main' of https://github.com/ludovic111/horizon into claude/2697-horse-make-mad-4431aa

📊 Changes

6 files changed (+153 additions, -17 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+24 -4)
📝 crates/horizon-client/src/game/mounts.rs (+44 -5)
📝 crates/horizon-client/src/mobs/ai.rs (+2 -1)
📝 crates/horizon-client/src/mobs/equine.rs (+64 -4)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java (+3 -3)
📝 tools/test_mob_ai_parity.py (+16 -0)

📄 Description

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

Fixes #2697.

What changed

Right-clicking an untamed adult horse with something in hand (a sword, say) seated the player. In vanilla the horse rears and plays its angry sound, and the player stays on the ground. Only an empty hand reaches doPlayerRide.

  • The held-item branch (Horse.mobInteract, AbstractChestedHorse.mobInteract for donkeys, mules and llamas, ZombieHorse.mobInteract): with no rider, not opening a tamed adult's inventory, and not a foal while the player holds a golden dandelion (zombie horses skip that last check), food goes to fedFood and anything else makes an untamed one mad (makeMad) instead of seating the player. The decision is the new equine::held_item in the lib. interact_mount uses it, so the server thread (the click reaches it through as_guest), LAN guests and in-frame all take it, and so does the probe.
  • An untamed skeleton horse ignores the click (SkeletonHorse.mobInteract returns PASS). It used to seat the player.
  • Donkeys and mules rear. Only Llama and Camel override canPerformRearing (checked in the 26.3 sources), so donkeys and mules rear in vanilla. Main's can_rear says "not donkeys or mules"; this PR changes that back, and the new sword_donkey and sword_mule scenarios match vanilla only with them rearing.
  • A rearing or eating horse runs no goals (AbstractHorse.isImmobile: isEating() || isStanding()). A mount steered by its rider still takes the rider's input (travelRidden doesn't depend on it). Without this, vanilla's horse stood still while Horizon's kept strolling and drawing randoms.
  • RandomStandGoal checks !isImmobile() before its nextInt(10). (Its ambient stand sound and the foal voices are now on main.)

Being bucked off on the server thread

The reporter also said an untamed horse never threw them off. RunAroundLikeCrazyGoal does run on the server thread for a server player (m.rider is set by tick_mount_riding inside as_guest), and it emits MobEvent::Buck. But mount_event only dismounted when self.riding == Some(mob), which is the window's own player, never a server player. Now a Buck with no local rider finds the guest whose vehicle is that horse and runs dismount_mount as that guest. leave_guest then tells their client.

Not in this PR:

  • The rearing animation flags reaching the client are #2685.
  • The smoke and taming hearts (entity events 6 and 7) are already on main. This branch merges main, and the Buck arm now dismounts the local or the guest rider, then sends the smoke.
  • MobEvent::Tamed still makes the server's own player_uuid the owner, not the guest who tamed the horse. That's worth a follow-up.
  • Feeding zombie horses red mushrooms (ZombieHorse.isFood): feed_mount still skips undead horses, so the click now does nothing (vanilla PASS when it doesn't eat) instead of seating the player.

Checked against vanilla 26.3

Decompiled 26.3 sources, plus tools/rea_vanilla.py for every canPerformRearing override (only AbstractHorse and Llama have one):

  • Horse.mobInteract, AbstractChestedHorse.mobInteract, ZombieHorse.mobInteract, SkeletonHorse.mobInteract, AbstractHorse.mobInteract, fedFood.
  • AbstractHorse.makeMad, standIfPossible, isImmobile, tick (the stand counter), getSoundVolume.
  • LivingEntity.makeSound, getVoicePitch, Mob.interact (name tags and leads come first, as in Horizon).
  • RandomStandGoal, RunAroundLikeCrazyGoal, and the getAngrySound and getAmbientSound overrides.
  • Camel.mobInteract has no makeMad branch, and camels are left as they were.

Tests

mob_ai harness, extended: a new interact TICK MOB ITEM line uses an item on a mob. The oracle calls mobInteract with it in the main hand, the same path as feed. The probe calls equine::held_item. Nine new sword_* scenarios: horse, donkey and llama (adults and foals), mule, zombie horse (at night, since it burns by day) and skeleton horse. Each takes a sword at ticks 20, 30 (still rearing: nothing) and 40 (stood down: mad again).

  • Vanilla plays 18 angry sounds across them. All 9 match tick for tick: positions, goals, randoms and sounds with volume and pitch.
  • horse_deep_water still matches.
  • The skeleton horse scenario stops at tick 45, before its first step sound. Horizon plays the block's step sound there instead of entity.horse.step, a separate gap.

In the game (target/fast, offscreen, fresh mktemp -d homes, server thread and --in-frame):

  • Held item: a cleared grass floor and summon horse ~3 ~ ~ {NoAI:1b,PersistenceRequired:1b}, then aim at the horse's middle and mouse right click.
    • With an iron sword in hand, status.riding stays null.
    • With an empty hand, the player rides the horse. Same result on both paths.
  • Bucking off (server thread): an untamed horse without NoAI, mounted with an empty hand, throws the player off within about a second.
    • The same run with only the new Buck arm removed still has the player riding after 30 s.

pr_ready on the head (rebased on upstream/main):

pr_ready (tools/pr_ready.py --base upstream/main on cachyos, against upstream/main at 6af60956e, 32 min 7 s)

Check Result
Scope ✅ 6 files, +173 −22
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 327 passed (16 s)
rustfmt ✅ (4 s)
clippy ✅ (31 s)
tests: horizon-client ✅ 1287 passed (2 min 4 s)
doc tests ✅ 0 passed (16 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 74 affected, 68 passed, failed: entity_model, friends_integration, remote_fireball, remote_fireworks, server_player_sculk (28 min 49 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The parity failures are this machine, not the change:

  • friends_integration, remote_fireball, remote_fireworks and server_player_sculk open real game windows on Linux. Their host never loads a chunk (wait-ready 400 times out), and remote_fireball fails the same way on plain upstream/main without this commit. All four passed in the first pr_ready run before the rebase.
  • entity_model compares cleanly ("0 layers differ from vanilla") but its oracle hits an IllegalAccessException on JDK 27 (the lock pins 25).
  • mob_ai, the harness this PR extends, matches all 180 scenarios.

🤖 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/2720 **Author:** [@ASOwnerYT](https://github.com/ASOwnerYT) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `claude/2697-horse-make-mad-4431aa` --- ### 📝 Commits (4) - [`1758b14`](https://github.com/horizon-rust/horizon/commit/1758b147b8bf7e6057040013d2e87aaf66094484) Untamed horses rear at a held item instead of taking the rider (#2697) - [`dae67a8`](https://github.com/horizon-rust/horizon/commit/dae67a88cc0eddf7fa93877bf34e84c2e063fe07) Merge remote-tracking branch 'upstream/main' into claude/2697-horse-make-mad-4431aa - [`e36a480`](https://github.com/horizon-rust/horizon/commit/e36a4800638f407aeca33c981e36b5d8c9a4ecbc) Merge remote-tracking branch 'upstream/main' into claude/2697-horse-make-mad-4431aa - [`1fa4a78`](https://github.com/horizon-rust/horizon/commit/1fa4a780f0cb16dd74b80a20a1f01ee768331b47) Merge branch 'main' of https://github.com/ludovic111/horizon into claude/2697-horse-make-mad-4431aa ### 📊 Changes **6 files changed** (+153 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+24 -4) 📝 `crates/horizon-client/src/game/mounts.rs` (+44 -5) 📝 `crates/horizon-client/src/mobs/ai.rs` (+2 -1) 📝 `crates/horizon-client/src/mobs/equine.rs` (+64 -4) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java` (+3 -3) 📝 `tools/test_mob_ai_parity.py` (+16 -0) </details> ### 📄 Description > 🤖 Opened by asowneryt's AI agent (Claude Code), not by asowneryt himself. Fixes #2697. ## What changed Right-clicking an untamed adult horse with something in hand (a sword, say) seated the player. In vanilla the horse rears and plays its angry sound, and the player stays on the ground. Only an empty hand reaches `doPlayerRide`. - **The held-item branch** (`Horse.mobInteract`, `AbstractChestedHorse.mobInteract` for donkeys, mules and llamas, `ZombieHorse.mobInteract`): with no rider, not opening a tamed adult's inventory, and not a foal while the player holds a golden dandelion (zombie horses skip that last check), food goes to `fedFood` and anything else makes an untamed one mad (`makeMad`) instead of seating the player. The decision is the new `equine::held_item` in the lib. `interact_mount` uses it, so the server thread (the click reaches it through `as_guest`), LAN guests and in-frame all take it, and so does the probe. - **An untamed skeleton horse ignores the click** (`SkeletonHorse.mobInteract` returns `PASS`). It used to seat the player. - **Donkeys and mules rear.** Only `Llama` and `Camel` override `canPerformRearing` (checked in the 26.3 sources), so donkeys and mules rear in vanilla. Main's `can_rear` says "not donkeys or mules"; this PR changes that back, and the new `sword_donkey` and `sword_mule` scenarios match vanilla only with them rearing. - **A rearing or eating horse runs no goals** (`AbstractHorse.isImmobile`: `isEating() || isStanding()`). A mount steered by its rider still takes the rider's input (`travelRidden` doesn't depend on it). Without this, vanilla's horse stood still while Horizon's kept strolling and drawing randoms. - **`RandomStandGoal`** checks `!isImmobile()` before its `nextInt(10)`. (Its ambient stand sound and the foal voices are now on main.) ### Being bucked off on the server thread The reporter also said an untamed horse never threw them off. `RunAroundLikeCrazyGoal` does run on the server thread for a server player (`m.rider` is set by `tick_mount_riding` inside `as_guest`), and it emits `MobEvent::Buck`. But `mount_event` only dismounted when `self.riding == Some(mob)`, which is the window's own player, never a server player. Now a `Buck` with no local rider finds the guest whose vehicle is that horse and runs `dismount_mount` as that guest. `leave_guest` then tells their client. Not in this PR: - The rearing animation flags reaching the client are #2685. - The smoke and taming hearts (entity events 6 and 7) are already on main. This branch merges main, and the `Buck` arm now dismounts the local or the guest rider, then sends the smoke. - `MobEvent::Tamed` still makes the server's own `player_uuid` the owner, not the guest who tamed the horse. That's worth a follow-up. - Feeding zombie horses red mushrooms (`ZombieHorse.isFood`): `feed_mount` still skips undead horses, so the click now does nothing (vanilla `PASS` when it doesn't eat) instead of seating the player. ## Checked against vanilla 26.3 Decompiled 26.3 sources, plus `tools/rea_vanilla.py` for every `canPerformRearing` override (only `AbstractHorse` and `Llama` have one): - `Horse.mobInteract`, `AbstractChestedHorse.mobInteract`, `ZombieHorse.mobInteract`, `SkeletonHorse.mobInteract`, `AbstractHorse.mobInteract`, `fedFood`. - `AbstractHorse.makeMad`, `standIfPossible`, `isImmobile`, `tick` (the stand counter), `getSoundVolume`. - `LivingEntity.makeSound`, `getVoicePitch`, `Mob.interact` (name tags and leads come first, as in Horizon). - `RandomStandGoal`, `RunAroundLikeCrazyGoal`, and the `getAngrySound` and `getAmbientSound` overrides. - `Camel.mobInteract` has no makeMad branch, and camels are left as they were. ## Tests **`mob_ai` harness, extended:** a new `interact TICK MOB ITEM` line uses an item on a mob. The oracle calls `mobInteract` with it in the main hand, the same path as `feed`. The probe calls `equine::held_item`. Nine new `sword_*` scenarios: horse, donkey and llama (adults and foals), mule, zombie horse (at night, since it burns by day) and skeleton horse. Each takes a sword at ticks 20, 30 (still rearing: nothing) and 40 (stood down: mad again). - Vanilla plays 18 angry sounds across them. All 9 match tick for tick: positions, goals, randoms and sounds with volume and pitch. - `horse_deep_water` still matches. - The skeleton horse scenario stops at tick 45, before its first step sound. Horizon plays the block's step sound there instead of `entity.horse.step`, a separate gap. **In the game** (`target/fast`, offscreen, fresh `mktemp -d` homes, server thread and `--in-frame`): - **Held item:** a cleared grass floor and `summon horse ~3 ~ ~ {NoAI:1b,PersistenceRequired:1b}`, then aim at the horse's middle and `mouse right click`. - With an iron sword in hand, `status.riding` stays `null`. - With an empty hand, the player rides the horse. Same result on both paths. - **Bucking off (server thread):** an untamed horse without `NoAI`, mounted with an empty hand, throws the player off within about a second. - The same run with only the new `Buck` arm removed still has the player riding after 30 s. `pr_ready` on the head (rebased on upstream/main): **pr_ready** (`tools/pr_ready.py --base upstream/main` on cachyos, against upstream/main at 6af60956e, 32 min 7 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +173 −22 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 327 passed (16 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (31 s) | | tests: horizon-client | ✅ 1287 passed (2 min 4 s) | | doc tests | ✅ 0 passed (16 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 74 affected, 68 passed, failed: entity_model, friends_integration, remote_fireball, remote_fireworks, server_player_sculk (28 min 49 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The parity failures are this machine, not the change: - `friends_integration`, `remote_fireball`, `remote_fireworks` and `server_player_sculk` open real game windows on Linux. Their host never loads a chunk (`wait-ready 400` times out), and `remote_fireball` fails the same way on plain `upstream/main` without this commit. All four passed in the first `pr_ready` run before the rebase. - `entity_model` compares cleanly ("0 layers differ from vanilla") but its oracle hits an `IllegalAccessException` on JDK 27 (the lock pins 25). - `mob_ai`, the harness this PR extends, matches all 180 scenarios. 🤖 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 04:18:05 +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#4563
No description provided.