[PR #7006] [MERGED] An iron golem takes the monster that bumps it as its target #7266

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7006
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/golem-do-push


📝 Commits (2)

  • 55a6edd An iron golem takes the monster that bumps it as its target
  • 630e4dc Skip the golem push test when the prepared world is missing

📊 Changes

3 files changed (+67 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/mobs/ai.rs (+65 -0)
📝 crates/horizon-client/src/mobs/golem.rs (+1 -1)
📝 tools/port_map/game-012.tsv (+1 -1)

📄 Description

Vanilla's IronGolem.doPush makes an Enemy that touches the golem its target one time in 20 (getRandom().nextInt(20) == 0), skipping creepers, and draws that random only for those monsters, then pushes the entity as AbstractGolem.doPush does.

Horizon's mobs/ai.rs::push_entities ran the Warden's touch hook and then the push, and had nothing for the iron golem, so a monster that bumped a golem never became its target and the golem only ever found enemies through its nearest-target goal.

Proven: on the build VM, cargo test -q -p horizon-client-lib --lib mobs::ai::iron_golem_push_tests passes the new an_iron_golem_targets_the_monster_that_bumps_it, which pushes a zombie, a creeper and a cow into a golem 400 times each: the zombie becomes the target within those draws, the creeper and the cow never do. rustfmt --edition 2024 --check passes on both files. The vanilla order (the Enemy/creeper test, then nextInt(20), then the push) is from javap -p -c net.minecraft.world.entity.animal.golem.IronGolem.

Not proven: the without-the-fix run of the same test and cargo clippy are pending: the build VM went into cooldown right after the passing run, so CI is the authority for those two, and I will run them on the VM as soon as it is back and report the results here. The in-game check is a zombie walking into a built iron golem and the golem turning on it within a few bumps.

Corrects the IronGolem.doPush row of tools/port_map/game-012.tsv.


🔄 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/7006 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/golem-do-push` --- ### 📝 Commits (2) - [`55a6edd`](https://github.com/horizon-rust/horizon/commit/55a6eddf8eca7f8385dcd7d61bcdb4410b420201) An iron golem takes the monster that bumps it as its target - [`630e4dc`](https://github.com/horizon-rust/horizon/commit/630e4dc8bcd3a5bdd0a47628eeb52fa63a7e9d79) Skip the golem push test when the prepared world is missing ### 📊 Changes **3 files changed** (+67 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/ai.rs` (+65 -0) 📝 `crates/horizon-client/src/mobs/golem.rs` (+1 -1) 📝 `tools/port_map/game-012.tsv` (+1 -1) </details> ### 📄 Description Vanilla's `IronGolem.doPush` makes an `Enemy` that touches the golem its target one time in 20 (`getRandom().nextInt(20) == 0`), skipping creepers, and draws that random only for those monsters, then pushes the entity as `AbstractGolem.doPush` does. Horizon's `mobs/ai.rs::push_entities` ran the Warden's touch hook and then the push, and had nothing for the iron golem, so a monster that bumped a golem never became its target and the golem only ever found enemies through its nearest-target goal. **Proven:** on the build VM, `cargo test -q -p horizon-client-lib --lib mobs::ai::iron_golem_push_tests` passes the new `an_iron_golem_targets_the_monster_that_bumps_it`, which pushes a zombie, a creeper and a cow into a golem 400 times each: the zombie becomes the target within those draws, the creeper and the cow never do. `rustfmt --edition 2024 --check` passes on both files. The vanilla order (the `Enemy`/creeper test, then `nextInt(20)`, then the push) is from `javap -p -c net.minecraft.world.entity.animal.golem.IronGolem`. **Not proven:** the without-the-fix run of the same test and `cargo clippy` are pending: the build VM went into cooldown right after the passing run, so CI is the authority for those two, and I will run them on the VM as soon as it is back and report the results here. The in-game check is a zombie walking into a built iron golem and the golem turning on it within a few bumps. Corrects the `IronGolem.doPush` row of `tools/port_map/game-012.tsv`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:36:42 +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#7266
No description provided.