[PR #7588] Native hooks: LevelEvent.PotentialSpawns and VillageSiegeEvent (potential_spawns, village_siege) #7696

Open
opened 2026-11-03 07:22:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7588
Author: @arismoko
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: v2/ses_01M6EA9PJ1AQ4Q6N2S9TNXP8B7-w3-level-misc


📝 Commits (10+)

  • 92ecb91 Add potential natural spawns hook
  • fd75a60 Apply potential spawn hook to validation lookup
  • 2f470c7 Add village siege native hook
  • 84e2ee5 Potential spawns hook: borrow the list and keep the fast path without mods
  • e88344f Regenerate the mod API
  • 0f2a760 Merge upstream main into w3-level-misc
  • d4bb9a2 Regenerate level hooks and fix catalog tests
  • 96e0000 Remove Java identity wording from spawn hook
  • 063b262 Merge upstream main into w3-level-misc
  • ef3d35d Retry siege setup after a canceled attempt

📊 Changes

9 files changed (+246 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/game/native_hooks.rs (+44 -1)
📝 crates/horizon-client/src/game/natural_spawning.rs (+22 -0)
📝 crates/horizon-client/src/game/raids.rs (+11 -1)
📝 crates/horizon-client/src/mobs/spawn_selection.rs (+49 -13)
📝 crates/horizon-client/src/mod_api.rs (+1 -1)
📝 crates/horizon-client/src/mod_api/generated.rs (+84 -0)
➕ tools/native-hook-fragments/native_potential_spawns.json (+17 -0)
➕ tools/native-hook-fragments/native_village_siege.json (+17 -0)
📝 xtask/src/mod_api.rs (+1 -0)

📄 Description

🤖 Opened by Aria's agent swarm, Dyna, not by Aria.

Part of #4953.

Hook NeoForge 26.3 counterpart Side Contract Vanilla firing point
potential_spawns LevelEvent.PotentialSpawns server cancel to empty the list; listeners can change entries in order NaturalSpawner.mobsAt, when building possible natural spawns
village_siege VillageSiegeEvent server cancel this setup attempt; retry next tick VillageSiege.tryToSetupSiege, after finding a spawn position

What changed and why

Expose the possible spawn entries for each natural-spawn lookup, preserving the borrowed list and avoiding allocation when no mods are loaded. Expose the selected player and attempted spawn position when a village siege finds a position, allowing a mod to cancel that setup attempt. As in vanilla, a failed setup is retried next tick.

Head: 0a5b17f53b21cf638dbbc060b41b148bd8219107; base: 2050c4e0f52b74ad5361f061e0a015e8bfc894b2.

Overlap

No same-purpose hook was found in the main catalog or remaining fragments.

Checks

Hook Check
potential_spawns In game at e88344fcef, integrated and dedicated server: nonempty monster lists; cancellation left no zombies nearby
village_siege In game at e88344fcef, integrated and dedicated server: attempted positions logged; cancellation spawned no siege zombies. At final head, integrated server: repeated canceled attempts on consecutive ticks, no nearby zombies

Clippy and xtask tests were also run. See the readiness block below for the exact-head gate.

Tested in game

At e88344fcef, the integrated server and dedicated server both reported nonempty monster spawn lists; cancelling potential_spawns left no zombies nearby. village_siege logged 7 events in single player and 11 on the dedicated server, including attempted positions; cancelling stopped siege zombies from spawning. At final head ef3d35dd97, a launcher-built throwaway mod canceled every siege attempt on an integrated server. With a controlled village, the hook logged newly selected positions on consecutive ticks 18000–18019; after 25 ticks no zombies were found within 100 blocks. Natural spawns were separately canceled to isolate siege zombies. The final change stops only the current attempt and allows the siege to retry next tick.

The recommended end-to-end test route is horizon-machine-sample. It was not used end to end: the launcher's install step failed while copying prepared resources for the earlier check, so that throwaway test mod ran in a game binary built directly at e88344fcef. The final-head retry check used a launcher-built throwaway mod instead.

pr_ready

pr_ready (tools/pr_ready.py --quick --base 2050c4e0f5 on 0e878892542c, against 2050c4e0f5 at 2050c4e0f, 12 min 10 s)

Check Result
Scope ✅ 9 files, +246 −16
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (48 s)
rustfmt ✅ (11 s)
clippy ✅ (1 min 45 s)
tests: horizon-client, horizon-client-lib, xtask ✅ 2180 passed (7 min 55 s)
doc tests ✅ 0 passed (1 min 10 s)
content root tests ➖ content root untouched
mod API up to date ✅ (21 s)
tokens.css up to date ✅
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Dyna.


🔄 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/7588 **Author:** [@arismoko](https://github.com/arismoko) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `v2/ses_01M6EA9PJ1AQ4Q6N2S9TNXP8B7-w3-level-misc` --- ### 📝 Commits (10+) - [`92ecb91`](https://github.com/horizon-rust/horizon/commit/92ecb918ed6d60ea6e05a2cb9abd3cf80985c4e2) Add potential natural spawns hook - [`fd75a60`](https://github.com/horizon-rust/horizon/commit/fd75a600c5df090594e4bbfa1d8735b2a2d23f44) Apply potential spawn hook to validation lookup - [`2f470c7`](https://github.com/horizon-rust/horizon/commit/2f470c7a8293380d5fefd7821db73da47fc36cdb) Add village siege native hook - [`84e2ee5`](https://github.com/horizon-rust/horizon/commit/84e2ee50ca3fbd2e4dbc8c390f5270bb64e3e480) Potential spawns hook: borrow the list and keep the fast path without mods - [`e88344f`](https://github.com/horizon-rust/horizon/commit/e88344fcefe02753b5bb877a8c7ce0f7ddce0ef3) Regenerate the mod API - [`0f2a760`](https://github.com/horizon-rust/horizon/commit/0f2a76003eb500668d4ea69dab96172a2173c91f) Merge upstream main into w3-level-misc - [`d4bb9a2`](https://github.com/horizon-rust/horizon/commit/d4bb9a2598591ac67336c586b6ac272aca9ab69d) Regenerate level hooks and fix catalog tests - [`96e0000`](https://github.com/horizon-rust/horizon/commit/96e0000c86695016926b734e042d5cafb093c9ed) Remove Java identity wording from spawn hook - [`063b262`](https://github.com/horizon-rust/horizon/commit/063b262b0c5c3a84f4f8b6decddf7f07be4616f3) Merge upstream main into w3-level-misc - [`ef3d35d`](https://github.com/horizon-rust/horizon/commit/ef3d35dd9722d5442754ae0548afe32938074f3d) Retry siege setup after a canceled attempt ### 📊 Changes **9 files changed** (+246 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/native_hooks.rs` (+44 -1) 📝 `crates/horizon-client/src/game/natural_spawning.rs` (+22 -0) 📝 `crates/horizon-client/src/game/raids.rs` (+11 -1) 📝 `crates/horizon-client/src/mobs/spawn_selection.rs` (+49 -13) 📝 `crates/horizon-client/src/mod_api.rs` (+1 -1) 📝 `crates/horizon-client/src/mod_api/generated.rs` (+84 -0) ➕ `tools/native-hook-fragments/native_potential_spawns.json` (+17 -0) ➕ `tools/native-hook-fragments/native_village_siege.json` (+17 -0) 📝 `xtask/src/mod_api.rs` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Aria's agent swarm, Dyna, not by Aria. Part of #4953. | Hook | NeoForge 26.3 counterpart | Side | Contract | Vanilla firing point | | --- | --- | --- | --- | --- | | `potential_spawns` | `LevelEvent.PotentialSpawns` | server | cancel to empty the list; listeners can change entries in order | `NaturalSpawner.mobsAt`, when building possible natural spawns | | `village_siege` | `VillageSiegeEvent` | server | cancel this setup attempt; retry next tick | `VillageSiege.tryToSetupSiege`, after finding a spawn position | ## What changed and why Expose the possible spawn entries for each natural-spawn lookup, preserving the borrowed list and avoiding allocation when no mods are loaded. Expose the selected player and attempted spawn position when a village siege finds a position, allowing a mod to cancel that setup attempt. As in vanilla, a failed setup is retried next tick. Head: `0a5b17f53b21cf638dbbc060b41b148bd8219107`; base: `2050c4e0f52b74ad5361f061e0a015e8bfc894b2`. ## Overlap No same-purpose hook was found in the main catalog or remaining fragments. ## Checks | Hook | Check | | --- | --- | | `potential_spawns` | In game at `e88344fcef`, integrated and dedicated server: nonempty monster lists; cancellation left no zombies nearby | | `village_siege` | In game at `e88344fcef`, integrated and dedicated server: attempted positions logged; cancellation spawned no siege zombies. At final head, integrated server: repeated canceled attempts on consecutive ticks, no nearby zombies | Clippy and xtask tests were also run. See the readiness block below for the exact-head gate. ## Tested in game At `e88344fcef`, the integrated server and dedicated server both reported nonempty monster spawn lists; cancelling `potential_spawns` left no zombies nearby. `village_siege` logged 7 events in single player and 11 on the dedicated server, including attempted positions; cancelling stopped siege zombies from spawning. At final head `ef3d35dd97`, a launcher-built throwaway mod canceled every siege attempt on an integrated server. With a controlled village, the hook logged newly selected positions on consecutive ticks 18000–18019; after 25 ticks no zombies were found within 100 blocks. Natural spawns were separately canceled to isolate siege zombies. The final change stops only the current attempt and allows the siege to retry next tick. The recommended end-to-end test route is [horizon-machine-sample](https://github.com/arismoko/horizon-machine-sample). It was not used end to end: the launcher's install step failed while copying prepared resources for the earlier check, so that throwaway test mod ran in a game binary built directly at `e88344fcef`. The final-head retry check used a launcher-built throwaway mod instead. ## pr_ready **pr_ready** (`tools/pr_ready.py --quick --base 2050c4e0f5` on 0e878892542c, against 2050c4e0f5 at 2050c4e0f, 12 min 10 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +246 −16 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (48 s) | | rustfmt | ✅ (11 s) | | clippy | ✅ (1 min 45 s) | | tests: horizon-client, horizon-client-lib, xtask | ✅ 2180 passed (7 min 55 s) | | doc tests | ✅ 0 passed (1 min 10 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (21 s) | | tokens.css up to date | ✅ | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with Dyna. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7696
No description provided.