[PR #4501] [MERGED] Iron golems draw the sprint particle's randoms; village goal parity scenarios #5659

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4501
Author: @xFedeT
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/iron-golem-village-parity


📝 Commits (1)

  • 46dfd69 Iron golems draw the sprint particle's randoms; mob_ai village scenarios

📊 Changes

3 files changed (+20 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/mobs/ai.rs (+8 -1)
📝 tools/port_map/game-009.tsv (+2 -2)
📝 tools/test_mob_ai_parity.py (+10 -0)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally.

Refs #3521

What and why

The rows GolemRandomStrollInVillageGoal and MoveBackToVillageGoal say iron golems do not stay in or go back to a village. That is wrong: both are registered in register_iron (#3948). But no mob_ai scenario had an iron golem near a village, so nothing compared them with vanilla.

Three new scenarios (iron_golem_village_0/1: a golem among a bed, a bell, a composter and a door; iron_golem_outside_village: one 30 blocks away; 400 ticks each) found one difference, at tick 139 to 275: IronGolem.canSpawnSprintParticle is horizontalDistanceSqr(motion) > 2.5000003E-7F && random.nextInt(5) == 0, whether the golem sprints or not, and spawnSprintParticle then draws the particle's x and z from the mob's random, though a server drops the particle. So a moving golem draws one random every tick and two more one time in five; Horizon drew none, and the golem's random (which every later wander and path choice reads) drifted from vanilla's. Fixed in base_tick.

Proof against vanilla's Java

python3 tools/test_mob_ai_parity.py --only iron_golem_: 3/3 scenarios, 1203/1203 mob-ticks identical (position, motion, running goals, path, every random draw); the two village goals do run in vanilla there (1152 ticks listing them). Before the fix all three diverged. The whole harness still matches: 212/212 scenarios, 62317/62317 mob-ticks.

Not covered: MoveThroughVillageGoal (zombies): a first draft of a night scenario never made the goal start in vanilla, so it proves nothing and is left out.

pr_ready --quick: fmt, clippy, 1064 tests and 481 python tests pass. Port-map rows updated.

🤖 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/4501 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/iron-golem-village-parity` --- ### 📝 Commits (1) - [`46dfd69`](https://github.com/horizon-rust/horizon/commit/46dfd693f5819f5603beaff62833cb8368677bbd) Iron golems draw the sprint particle's randoms; mob_ai village scenarios ### 📊 Changes **3 files changed** (+20 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/ai.rs` (+8 -1) 📝 `tools/port_map/game-009.tsv` (+2 -2) 📝 `tools/test_mob_ai_parity.py` (+10 -0) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Refs #3521 ## What and why The rows `GolemRandomStrollInVillageGoal` and `MoveBackToVillageGoal` say iron golems do not stay in or go back to a village. That is wrong: both are registered in `register_iron` (#3948). But no `mob_ai` scenario had an iron golem near a village, so nothing compared them with vanilla. Three new scenarios (`iron_golem_village_0/1`: a golem among a bed, a bell, a composter and a door; `iron_golem_outside_village`: one 30 blocks away; 400 ticks each) found one difference, at tick 139 to 275: `IronGolem.canSpawnSprintParticle` is `horizontalDistanceSqr(motion) > 2.5000003E-7F && random.nextInt(5) == 0`, whether the golem sprints or not, and `spawnSprintParticle` then draws the particle's x and z from the mob's random, though a server drops the particle. So a moving golem draws one random every tick and two more one time in five; Horizon drew none, and the golem's random (which every later wander and path choice reads) drifted from vanilla's. Fixed in `base_tick`. ## Proof against vanilla's Java `python3 tools/test_mob_ai_parity.py --only iron_golem_`: **3/3 scenarios, 1203/1203 mob-ticks identical** (position, motion, running goals, path, every random draw); the two village goals do run in vanilla there (1152 ticks listing them). Before the fix all three diverged. The whole harness still matches: 212/212 scenarios, 62317/62317 mob-ticks. Not covered: `MoveThroughVillageGoal` (zombies): a first draft of a night scenario never made the goal start in vanilla, so it proves nothing and is left out. `pr_ready --quick`: fmt, clippy, 1064 tests and 481 python tests pass. Port-map rows updated. 🤖 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 05:14:08 +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#5659
No description provided.