Compare commits

...
Author SHA1 Message Date
Ludovic Marie 5de5b6fd91 Merge pull request #12046 from horizon-rust/mods/stamp-chunk-tickets
🤖 Agent: stamps the existing chunk_tickets fragments (API 412/413, NATIVE_HOOKS_API 413); tests.test_stamp_native_hooks 10 OK, verify green, and this exact head built into the SMP engine on playhorizon (rtp2), whose /rtp proof passes with no slow tick. The SMP 0.35.1 PR in horizon-mods needs it.
2026-11-07 22:01:20 +01:00
Horizon agentandClaude Opus 5.5 3a229da6b3 mod API: stamp chunk_tickets (412) and chunk_tickets_in_level (413)
python3 tools/stamp_native_hooks.py --only chunk_tickets chunk_tickets_in_level.
The SMP's /rtp moves from /forceload (which waits on the server thread
until its chunk is generated) to native_force_chunk_in, so it needs a
number to declare.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 21:19:46 +01:00
6 changed files with 25 additions and 28 deletions

No files matched your search

@@ -18,7 +18,7 @@ impl Game<'_> {
/// or the server stops, not saved: keep what you hold (a level
/// attachment) and hold it again in `native_level_load`. True when the
/// set of owners changed; false for an owner without a namespace, a chunk
/// past the world's edge (as `/forceload` refuses it) and off a server. API @API:chunk_tickets@.
/// past the world's edge (as `/forceload` refuses it) and off a server. API 412.
pub(super) fn native_force_chunk(&mut self, owner: &str, chunk: [i32; 2], hold: bool) -> bool {
self.native_chunk_ticket(self.dim, owner, chunk, hold)
}
@@ -28,7 +28,7 @@ impl Game<'_> {
/// level held this way opens at the next server tick and ticks from then
/// on, so a mod can generate or run the Nether and the End from any
/// server hook. False also for a dimension other than the Overworld, the
/// Nether and the End. API @API:chunk_tickets_in_level@.
/// Nether and the End. API 413.
pub(super) fn native_force_chunk_in(
&mut self,
owner: &str,
@@ -103,7 +103,7 @@ impl Game<'_> {
}
/// The chunks of the level in place `owner` holds (`native_force_chunk`),
/// sorted. API @API:chunk_tickets@.
/// sorted. API 412.
pub(super) fn native_forced_chunks(&self, owner: &str) -> Vec<[i32; 2]> {
let mut held: Vec<[i32; 2]> = self
.mod_chunk_tickets
@@ -6,6 +6,10 @@
//! Horizon's own HUD extras do, and keep a mod's settings where the
//! WebAssembly mod of the same id kept them.
//!
//! API 413 adds chunk tickets in a level nobody is in (`native_force_chunk_in`).
//!
//! API 412 adds chunks a mod keeps loaded and ticking (`native_force_chunk`, `native_forced_chunks`).
//!
//! API 411 adds client Host services, GUI painting, model-head snapshots and client lifecycle notifications.
//!
//! API 410 adds a final foreground GUI overlay (`native_gui_render_post`) and the current frame's camera during GUI rendering.
@@ -1167,7 +1171,7 @@ pub(super) use horizon_world::level::flags;
/// The hook points' API version. The launcher reads this line from the
/// source it builds; keep its form.
pub(crate) const NATIVE_HOOKS_API: u32 = 411;
pub(crate) const NATIVE_HOOKS_API: u32 = 413;
impl GameLevel<'_> {
/// A hopper at `pos` is about to pick up `count` of `item`. Set `cancel` to leave the dropped stack in the world. Server-side. 232.
+5 -1
View File
@@ -1787,6 +1787,10 @@ API 410 adds `native_gui_render_post(batch, gui_hidden, focused)` draws after th
API 411 adds Client-only Host snapshots of the window, connection, entities, interpolated model heads and profile skins; visual rays and block occlusion facts; atlas GUI painting, nine-slice widgets and tooltips; persisted mod key changes and a local action bar. client_start runs before connecting (a window need not exist yet), client_disconnecting before a real connection is discarded (not dimension travel), client_stopping once before final save/exit. menu_background can change a normal menu blur request (None disables it; finite 1..64 only). Bundles need "hooks": 411.
API 412 adds `native_force_chunk(owner, chunk, hold)` holds a chunk of the level in place loaded and ticking for `owner`, as NeoForge's `TicketController.forceChunk`; `native_forced_chunks(owner)` lists what it holds. Tickets aren't saved. Bundles need "hooks": 412.
API 413 adds `native_force_chunk_in(owner, dimension, chunk, hold)`, `native_force_chunk` for a named level, which opens and ticks a level not open yet, so a mod can pre-generate the Nether and the End with nobody there. Bundles need "hooks": 413.
## What the launcher does
**Developing a mod?** Run `horizon-launcher settings native-profile dev` once, or pick "Dev build" in the Mods page's
@@ -2649,7 +2653,7 @@ server only.
level nobody is in, or one not open yet, opens at the next server tick and ticks while a ticket holds it, so a
pre-generator walks the Nether and the End from any server hook (a console command, `native_level_tick_pre` of the
Overworld) with nobody there. False for a dimension other than the Overworld, the Nether and the End. API
@API:chunk_tickets_in_level@.
413.
- **`native_world_border(dimension)`** (`native_world_border.rs`): the level's world border as the server enforces it,
`[min_x, min_z, max_x, max_z]` in blocks (the previous size while it moves), for a web map's border line or a
pre-generator's `worldborder` selection. Vanilla 26.3 keeps a border per level (`ServerLevel.getWorldBorder`, each
+12
View File
@@ -733,6 +733,18 @@
{
"name": "player",
"target": "horizon_client::game::native_hooks::Game<'_>::native_player"
},
{
"name": "force_chunk",
"target": "horizon_client::game::native_chunk_tickets::Game<'_>::native_force_chunk"
},
{
"name": "forced_chunks",
"target": "horizon_client::game::native_chunk_tickets::Game<'_>::native_forced_chunks"
},
{
"name": "force_chunk_in",
"target": "horizon_client::game::native_chunk_tickets::Game<'_>::native_force_chunk_in"
}
],
"hooks": [
@@ -1,12 +0,0 @@
{
"hooks": [],
"helpers": [
{"name": "force_chunk", "target": "horizon_client::game::native_chunk_tickets::Game<'_>::native_force_chunk"},
{"name": "forced_chunks", "target": "horizon_client::game::native_chunk_tickets::Game<'_>::native_forced_chunks"}
],
"rust_summary": "chunks a mod keeps loaded and ticking (`native_force_chunk`, `native_forced_chunks`).",
"doc_summary": "`native_force_chunk(owner, chunk, hold)` holds a chunk of the level in place loaded and ticking for `owner`, as NeoForge's `TicketController.forceChunk`; `native_forced_chunks(owner)` lists what it holds. Tickets aren't saved. Bundles need \"hooks\": @API:chunk_tickets@.",
"comments": [
"crates/horizon-client/src/game/native_chunk_tickets.rs"
]
}
@@ -1,11 +0,0 @@
{
"hooks": [],
"helpers": [
{"name": "force_chunk_in", "target": "horizon_client::game::native_chunk_tickets::Game<'_>::native_force_chunk_in"}
],
"rust_summary": "chunk tickets in a level nobody is in (`native_force_chunk_in`).",
"doc_summary": "`native_force_chunk_in(owner, dimension, chunk, hold)`, `native_force_chunk` for a named level, which opens and ticks a level not open yet, so a mod can pre-generate the Nether and the End with nobody there. Bundles need \"hooks\": @API:chunk_tickets_in_level@.",
"comments": [
"crates/horizon-client/src/game/native_chunk_tickets.rs"
]
}