[PR #1537] [MERGED] Villagers, llamas, bees, allays and copper golems search the full path budget #3568

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

📋 Pull Request Information

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

Base: main ← Head: fix/mob-path-max-visited


📝 Commits (1)

  • 5205b90 Villagers, llamas, bees, allays and copper golems search the full path budget

📊 Changes

12 files changed (+45 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/sculk.rs (+1 -0)
📝 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 (+1 -1)
📝 tools/test_mob_ai_parity.py (+10 -0)

📄 Description

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

Villagers in Horizon gave up on job sites, beds and the bell that vanilla villagers reach, whenever the way there went around a house or over a hill.

Cause. Vanilla's PathNavigation.setRequiredPathLength(L) (and onAttributeUpdated for the follow range) recompute PathFinder.maxVisitedNodes = floor(max(followRange, requiredPathLength) * 16). Horizon kept the constructor's budget of followRange * 16 forever. A villager (follow range 16, required path length 48) searched 256 nodes instead of 768, so AcquirePoi and SetWalkTargetFromBlockMemory found no path where vanilla found one. The same applies to bees, allays and copper golems (48), llamas (40), baby happy ghasts (48), and to the follow range bonus that finalizeSpawn, the creaking heart and sculk catalysts add.

Fix. Navigation::max_visited_nodes is set from the follow range when the mob is built. Mob::set_required_path_length and every follow range change recompute it the way vanilla does.

Check. A new mob_ai scenario, villager_job_in_box: a jobless villager outside a stone box, the composter inside, and the doorway on the far side.

  • Before (measured on #1536's head): first divergence at tick 16 … vanilla potential_job_site=70144,-60,0 | horizon (none).
  • After: 301/301 ticks match. The whole mob_ai harness gives 135/135 scenarios and 50138/50138 mob-ticks.
  • A replica of the seed-12345 mason house from vanilla's own save: vanilla reaches the stonecutter with 500 closed nodes. Before the fix Horizon stopped at 255 nodes and had no path. After, it reaches it with 501, and all 121 ticks match.

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

Independent of #1536, which makes villagers open doors; both are needed for the zekrom43 village report.

🤖 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/1537 **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/mob-path-max-visited` --- ### 📝 Commits (1) - [`5205b90`](https://github.com/horizon-rust/horizon/commit/5205b909f79740ae620a3892aeec58407f1a80c3) Villagers, llamas, bees, allays and copper golems search the full path budget ### 📊 Changes **12 files changed** (+45 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/sculk.rs` (+1 -0) 📝 `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` (+1 -1) 📝 `tools/test_mob_ai_parity.py` (+10 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Villagers in Horizon gave up on job sites, beds and the bell that vanilla villagers reach, whenever the way there went around a house or over a hill. **Cause.** Vanilla's `PathNavigation.setRequiredPathLength(L)` (and `onAttributeUpdated` for the follow range) recompute `PathFinder.maxVisitedNodes = floor(max(followRange, requiredPathLength) * 16)`. Horizon kept the constructor's budget of `followRange * 16` forever. A villager (follow range 16, required path length 48) searched 256 nodes instead of 768, so `AcquirePoi` and `SetWalkTargetFromBlockMemory` found no path where vanilla found one. The same applies to bees, allays and copper golems (48), llamas (40), baby happy ghasts (48), and to the follow range bonus that `finalizeSpawn`, the creaking heart and sculk catalysts add. **Fix.** `Navigation::max_visited_nodes` is set from the follow range when the mob is built. `Mob::set_required_path_length` and every follow range change recompute it the way vanilla does. **Check.** A new mob_ai scenario, `villager_job_in_box`: a jobless villager outside a stone box, the composter inside, and the doorway on the far side. - Before (measured on #1536's head): `first divergence at tick 16 … vanilla potential_job_site=70144,-60,0 | horizon (none)`. - After: 301/301 ticks match. The whole mob_ai harness gives 135/135 scenarios and 50138/50138 mob-ticks. - A replica of the seed-12345 mason house from vanilla's own save: vanilla reaches the stonecutter with 500 closed nodes. Before the fix Horizon stopped at 255 nodes and had no path. After, it reaches it with 501, and all 121 ticks match. Self-check: `cargo fmt --check` ok; `cargo clippy --workspace --all-targets -- -D warnings` ok; `cargo test -p horizon-client` ok (1075 passed); `tools/parity.py --changed origin/main`: 106 passed, 0 failed. Independent of #1536, which makes villagers open doors; both are needed for the zekrom43 village report. 🤖 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:29 +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#3568
No description provided.