[PR #1540] [MERGED] Villagers summon iron golems the vanilla way and remember them #3570

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1540
Author: @ludovic111
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ludovic111

Base: main ← Head: fix/villager-golem-summon


📝 Commits (2)

  • 5205b90 Villagers, llamas, bees, allays and copper golems search the full path budget
  • 1b14e0d Villagers summon iron golems the vanilla way and remember them

📊 Changes

16 files changed (+301 additions, -112 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+52 -0)
📝 crates/horizon-client/src/game/sculk.rs (+1 -0)
📝 crates/horizon-client/src/game/villagers.rs (+36 -99)
📝 crates/horizon-client/src/mobs.rs (+2 -0)
📝 crates/horizon-client/src/mobs/allay.rs (+1 -1)
📝 crates/horizon-client/src/mobs/bee.rs (+1 -1)
📝 crates/horizon-client/src/mobs/copper_golem.rs (+1 -1)
📝 crates/horizon-client/src/mobs/creaking_heart.rs (+1 -0)
📝 crates/horizon-client/src/mobs/finalize.rs (+4 -1)
📝 crates/horizon-client/src/mobs/happy_ghast.rs (+5 -1)
📝 crates/horizon-client/src/mobs/llama.rs (+1 -1)
📝 crates/horizon-client/src/mobs/nav.rs (+17 -2)
📝 crates/horizon-client/src/mobs/villager.rs (+139 -1)
📝 crates/horizon-client/src/mobs/villager_brain.rs (+8 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java (+6 -4)
📝 tools/test_mob_ai_parity.py (+26 -0)

📄 Description

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

Stacked on #1537 (it adds to the same mob_ai scenario list). Merge #1537 first. This PR's own commit is the top one.

Villagers summon iron golems the way vanilla does (Villager.spawnGolemIfNeeded from gossip, and from VillagerPanicTrigger every 100 ticks). Three differences are fixed:

  • The villagers forgot the new golem. Vanilla sets GOLEM_DETECTED_RECENTLY (599 ticks) on every villager near a new golem. Horizon wrote only villager::Ext::golem_until, and the next brain tick's sync copied the empty brain memory back over it. Until their GolemSensor scan saw the golem, the same villagers could summon a second one. villager_brain::golem_detected now sets the brain memory.
  • IronGolem.checkSpawnObstruction. Horizon checked four free blocks and never the floor. Vanilla checks three free blocks, ignores the fluid at the feet, and needs entityCanStandOn below it. So in Horizon a roof three blocks up kept golems out, and golems could appear on dirt paths, farmland or slabs, which vanilla never allows.
  • Smaller points. The search's open block is air or a liquid block, not any waterlogged block. The villagers asked are those whose boxes meet the caller's box grown by 10. The golem is created before the obstruction check, so its yaw, follow range bonus and left-handedness are drawn from the level random first, as in trySpawnMob.

The search and the checks move to mobs::villager (golem_summoners, summon_golem, finalize_summoned_golem). The game and the mob_ai probe now run the same code. The probe used to drop GolemCheck and gossip summons, and the oracle now tracks the iron golems it spawns.

Check. Four new mob_ai scenarios: five gossiping villagers, the same under a glass roof three blocks up, the same on dirt paths, and three villagers panicking at a zombie in a pen.

  • After: all four match vanilla; the whole harness gives 141/141 scenarios and 55662/55662 mob-ticks.
  • Before (the old memory and obstruction checks, through the same probe code): all four diverge. In gossip, roof and panic the villagers lack golem_detected_recently on the summoning tick. Under the roof the golem stands elsewhere. On the paths a golem appears that vanilla never spawns, and the villagers diverge from tick 201.

The scenarios stop on the summoning tick. After it, the golem's own AI diverges: Horizon's iron golem has neither MoveBackToVillageGoal nor GolemRandomStrollInVillageGoal, and uses a plain stroll instead. That is a separate port and is not in this PR.

Seed-12345 village, dedicated servers, about four in-game days: vanilla and Horizon (with #1536 and #1537) both kept 5 adult villagers, 1 iron golem and 1 cat, with 3 homes and 2 job sites. In-frame and on the server thread after three days, Horizon had 5 villagers, 1 golem and 1 cat, with 2 homes and 1 or 2 job sites.

Self-check (on this branch): cargo fmt --check ok; cargo clippy --workspace --all-targets -- -D warnings ok; cargo test -p horizon-client ok (1198 passed); tools/parity.py --changed origin/main: 106 passed, 0 failed.

🤖 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/1540 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/villager-golem-summon` --- ### 📝 Commits (2) - [`5205b90`](https://github.com/horizon-rust/horizon/commit/5205b909f79740ae620a3892aeec58407f1a80c3) Villagers, llamas, bees, allays and copper golems search the full path budget - [`1b14e0d`](https://github.com/horizon-rust/horizon/commit/1b14e0d17170f61a536f44efab078651f2685e56) Villagers summon iron golems the vanilla way and remember them ### 📊 Changes **16 files changed** (+301 additions, -112 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+52 -0) 📝 `crates/horizon-client/src/game/sculk.rs` (+1 -0) 📝 `crates/horizon-client/src/game/villagers.rs` (+36 -99) 📝 `crates/horizon-client/src/mobs.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs/allay.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/bee.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/copper_golem.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/creaking_heart.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/finalize.rs` (+4 -1) 📝 `crates/horizon-client/src/mobs/happy_ghast.rs` (+5 -1) 📝 `crates/horizon-client/src/mobs/llama.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/nav.rs` (+17 -2) 📝 `crates/horizon-client/src/mobs/villager.rs` (+139 -1) 📝 `crates/horizon-client/src/mobs/villager_brain.rs` (+8 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java` (+6 -4) 📝 `tools/test_mob_ai_parity.py` (+26 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1537 (it adds to the same mob_ai scenario list). Merge #1537 first. This PR's own commit is the top one. Villagers summon iron golems the way vanilla does (`Villager.spawnGolemIfNeeded` from gossip, and from `VillagerPanicTrigger` every 100 ticks). Three differences are fixed: - **The villagers forgot the new golem.** Vanilla sets `GOLEM_DETECTED_RECENTLY` (599 ticks) on every villager near a new golem. Horizon wrote only `villager::Ext::golem_until`, and the next brain tick's `sync` copied the empty brain memory back over it. Until their `GolemSensor` scan saw the golem, the same villagers could summon a second one. `villager_brain::golem_detected` now sets the brain memory. - **`IronGolem.checkSpawnObstruction`.** Horizon checked four free blocks and never the floor. Vanilla checks three free blocks, ignores the fluid at the feet, and needs `entityCanStandOn` below it. So in Horizon a roof three blocks up kept golems out, and golems could appear on dirt paths, farmland or slabs, which vanilla never allows. - **Smaller points.** The search's open block is air or a liquid block, not any waterlogged block. The villagers asked are those whose boxes meet the caller's box grown by 10. The golem is created before the obstruction check, so its yaw, follow range bonus and left-handedness are drawn from the level random first, as in `trySpawnMob`. The search and the checks move to `mobs::villager` (`golem_summoners`, `summon_golem`, `finalize_summoned_golem`). The game and the mob_ai probe now run the same code. The probe used to drop `GolemCheck` and gossip summons, and the oracle now tracks the iron golems it spawns. **Check.** Four new mob_ai scenarios: five gossiping villagers, the same under a glass roof three blocks up, the same on dirt paths, and three villagers panicking at a zombie in a pen. - After: all four match vanilla; the whole harness gives 141/141 scenarios and 55662/55662 mob-ticks. - Before (the old memory and obstruction checks, through the same probe code): all four diverge. In gossip, roof and panic the villagers lack `golem_detected_recently` on the summoning tick. Under the roof the golem stands elsewhere. On the paths a golem appears that vanilla never spawns, and the villagers diverge from tick 201. The scenarios stop on the summoning tick. After it, the golem's own AI diverges: Horizon's iron golem has neither `MoveBackToVillageGoal` nor `GolemRandomStrollInVillageGoal`, and uses a plain stroll instead. That is a separate port and is not in this PR. Seed-12345 village, dedicated servers, about four in-game days: vanilla and Horizon (with #1536 and #1537) both kept 5 adult villagers, 1 iron golem and 1 cat, with 3 homes and 2 job sites. In-frame and on the server thread after three days, Horizon had 5 villagers, 1 golem and 1 cat, with 2 homes and 1 or 2 job sites. Self-check (on this branch): `cargo fmt --check` ok; `cargo clippy --workspace --all-targets -- -D warnings` ok; `cargo test -p horizon-client` ok (1198 passed); `tools/parity.py --changed origin/main`: 106 passed, 0 failed. 🤖 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:10:31 +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#3570
No description provided.