[PR #5005] [MERGED] Let the universal_anger rule reach a wolf's target goal #6000

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5005
Author: @MSedgeMC
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/universal-anger


📝 Commits (1)

  • 1e14c90 Let the universal_anger rule reach a wolf's target goal

📊 Changes

7 files changed (+68 additions, -4 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+2 -0)
📝 crates/horizon-client/src/mobs.rs (+2 -0)
📝 crates/horizon-client/src/mobs/golem.rs (+2 -2)
📝 crates/horizon-client/src/mobs/tame.rs (+59 -2)
📝 crates/horizon-client/src/mobs/world.rs (+1 -0)
📝 crates/horizon-client/src/mobs/zombie_villager.rs (+1 -0)

📄 Description

Fixes the NeutralMob.isAngryAtAllPlayers row in the port ledger. (No issue.)

NeutralMob.isAngryAtAllPlayers is universal_anger && isAngry() && getPersistentAngerTarget() == null, and isAngryAt asks it for a player before falling back to the named target — so with the rule on, a mob that is still angry but has lost its target is angry at any player. Creative, spectator and peaceful players are still excluded, by isValidPlayerTarget. Horizon registered the rule (gamerules.rs), saved and loaded it with the rest of game_rules.dat, and then no code ever read it: the wolf's player target predicate was angry_at == Some(Who::Player) and nothing else.

The rule now reaches the predicate through MobWorld — carried the same way mob_griefing, mob_drops and max_entity_cramping already are, so it comes from ui.rules on every path (in-frame, server thread, LAN host, dedicated). The creative/spectator exclusion needed no work: can_target_player already drops those before the predicate runs, which is isValidPlayerTarget.

Proven: cargo test -p horizon-client --lib universal_anger → 1 passed on a build box with the prepared data: a wolf at 600 ticks of anger with no angry_at, run through its own registered target goals for 200 ticks, targets the player with the rule on, does not with it off, and does not when the player is creative.

Not proven: nothing in a game, and the test skips on a machine without .local/, so CI is where it first really runs.

Three things deliberately left, each its own change:

  • The zombified piglin is not routed through the predicate. It never maintains angry_at (it uses a bare anger counter), so with the rule off it would lose the ability to re-acquire a player it had lost sight of — a regression, not a fix. It is already over-eager (it behaves as though the rule were always on); making it correct needs its persistent-target sync.
  • Iron golem and polar bear keep their anger > 0 gates: moving them onto vanilla's predicate also changes what they do when angry at a mob, which I cannot validate without a harness.
  • ResetUniversalAngerTargetGoal is still missing, and it is what creates the "angry with no target" state in play (hit a mob with the rule on, it drops the target and refreshes its anger). Without it this fix is reachable from saved state — anger_end_time ahead with no angry_at, which vanilla writes — but the player-visible half needs that goal. Worth knowing before anyone calls the rule done.

The ledger row is left alone: port_ledger.py needs a build against vanilla sources this checkout does not have, and a bad verdict row is worse than a stale one.


🔄 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/5005 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/universal-anger` --- ### 📝 Commits (1) - [`1e14c90`](https://github.com/horizon-rust/horizon/commit/1e14c9071126549be660565b2303c0041b57b93e) Let the universal_anger rule reach a wolf's target goal ### 📊 Changes **7 files changed** (+68 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs/golem.rs` (+2 -2) 📝 `crates/horizon-client/src/mobs/tame.rs` (+59 -2) 📝 `crates/horizon-client/src/mobs/world.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/zombie_villager.rs` (+1 -0) </details> ### 📄 Description Fixes the `NeutralMob.isAngryAtAllPlayers` row in the port ledger. (No issue.) `NeutralMob.isAngryAtAllPlayers` is `universal_anger && isAngry() && getPersistentAngerTarget() == null`, and `isAngryAt` asks it for a player before falling back to the named target — so with the rule on, a mob that is still angry but has lost its target is angry at **any** player. Creative, spectator and peaceful players are still excluded, by `isValidPlayerTarget`. Horizon registered the rule (`gamerules.rs`), saved and loaded it with the rest of `game_rules.dat`, and then no code ever read it: the wolf's player target predicate was `angry_at == Some(Who::Player)` and nothing else. The rule now reaches the predicate through `MobWorld` — carried the same way `mob_griefing`, `mob_drops` and `max_entity_cramping` already are, so it comes from `ui.rules` on every path (in-frame, server thread, LAN host, dedicated). The creative/spectator exclusion needed no work: `can_target_player` already drops those before the predicate runs, which is `isValidPlayerTarget`. **Proven:** `cargo test -p horizon-client --lib universal_anger` → 1 passed on a build box with the prepared data: a wolf at 600 ticks of anger with no `angry_at`, run through its own registered target goals for 200 ticks, targets the player with the rule on, does not with it off, and does not when the player is creative. **Not proven:** nothing in a game, and the test skips on a machine without `.local/`, so CI is where it first really runs. Three things deliberately left, each its own change: - **The zombified piglin is not routed through the predicate.** It never maintains `angry_at` (it uses a bare `anger` counter), so with the rule off it would lose the ability to re-acquire a player it had lost sight of — a regression, not a fix. It is already over-eager (it behaves as though the rule were always on); making it correct needs its persistent-target sync. - **Iron golem and polar bear** keep their `anger > 0` gates: moving them onto vanilla's predicate also changes what they do when angry at a mob, which I cannot validate without a harness. - **`ResetUniversalAngerTargetGoal` is still missing**, and it is what *creates* the "angry with no target" state in play (hit a mob with the rule on, it drops the target and refreshes its anger). Without it this fix is reachable from saved state — `anger_end_time` ahead with no `angry_at`, which vanilla writes — but the player-visible half needs that goal. Worth knowing before anyone calls the rule done. The ledger row is left alone: `port_ledger.py` needs a build against vanilla sources this checkout does not have, and a bad verdict row is worse than a stale one. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:32 +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#6000
No description provided.