[PR #5006] [MERGED] Keep an iron golem from fighting the creepers it refuses #6002

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/5006
Author: @MSedgeMC
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/golem-creeper-refusal


📝 Commits (1)

  • 95a4e8e Keep an iron golem from fighting the creepers it refuses

📊 Changes

2 files changed (+88 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/mobs/goals.rs (+19 -2)
📝 crates/horizon-client/src/mobs/golem.rs (+69 -0)

📄 Description

Fixes the creeper half of IronGolem.canAttack, found while correcting the ledger row for the player half. (No issue.)

IronGolem.canAttack is !(isPlayerCreated() && target.is(PLAYER)) && !target.is(CREEPER) && super.canAttack(target), and vanilla asks it in four places: the retaliation goal (HurtByTargetGoal.canUse ends with canAttack), target continuation (TargetGoal.canContinueToUse starts with it), the nearest-target search (TargetingConditions.test), and NeutralMob.isAngryAt. Horizon mirrored only the player rule — and only for the player paths — so a creeper that hit an iron golem became its target and the golem hit back, which vanilla never allows.

The predicate is now target-aware (Mob::spares_target, with spares_players as its player arm) and the two call sites that had no answer use it: retaliation, which is the actual gap, and target continuation, so an existing creeper target is dropped.

Proven: cargo test -p horizon-client --lib creeper → 1 passed on a build box: a creeper that hurts an iron golem never becomes its target, a zombie that hurts it does, and a village golem still targets the player who angered it.

Not proven: nothing in a game — the honest check is a creeper bumping a golem in survival and the golem ignoring it while still attacking a zombie beside it.

Left alone deliberately: golem_prey already filters creepers for the nearest-target search (it mirrors vanilla's selector lambda), the golem's anger is player-only in Horizon so isAngryAt has no creeper path to fix, and no other mob's targeting changes — the new predicate refuses only golem→creeper plus the existing player rules.


🔄 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/5006 **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/golem-creeper-refusal` --- ### 📝 Commits (1) - [`95a4e8e`](https://github.com/horizon-rust/horizon/commit/95a4e8effa048b0d470efc0742a3551943ccf0a4) Keep an iron golem from fighting the creepers it refuses ### 📊 Changes **2 files changed** (+88 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/goals.rs` (+19 -2) 📝 `crates/horizon-client/src/mobs/golem.rs` (+69 -0) </details> ### 📄 Description Fixes the creeper half of `IronGolem.canAttack`, found while correcting the ledger row for the player half. (No issue.) `IronGolem.canAttack` is `!(isPlayerCreated() && target.is(PLAYER)) && !target.is(CREEPER) && super.canAttack(target)`, and vanilla asks it in four places: the retaliation goal (`HurtByTargetGoal.canUse` ends with `canAttack`), target continuation (`TargetGoal.canContinueToUse` starts with it), the nearest-target search (`TargetingConditions.test`), and `NeutralMob.isAngryAt`. Horizon mirrored only the player rule — and only for the player paths — so a creeper that hit an iron golem became its target and the golem hit back, which vanilla never allows. The predicate is now target-aware (`Mob::spares_target`, with `spares_players` as its player arm) and the two call sites that had no answer use it: retaliation, which is the actual gap, and target continuation, so an existing creeper target is dropped. **Proven:** `cargo test -p horizon-client --lib creeper` → 1 passed on a build box: a creeper that hurts an iron golem never becomes its target, a zombie that hurts it does, and a village golem still targets the player who angered it. **Not proven:** nothing in a game — the honest check is a creeper bumping a golem in survival and the golem ignoring it while still attacking a zombie beside it. Left alone deliberately: `golem_prey` already filters creepers for the nearest-target search (it mirrors vanilla's selector lambda), the golem's anger is player-only in Horizon so `isAngryAt` has no creeper path to fix, and no other mob's targeting changes — the new predicate refuses only golem→creeper plus the existing player rules. --- <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#6002
No description provided.