[PR #5729] [MERGED] feat(mods): native mods can read the world's clock #6463

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5729
Author: @Stink-O
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @levzzz5154

Base: main ← Head: native/clock


📝 Commits (4)

  • 9dc99a5 feat(mods): native mods can read the world's clock
  • 54335a4 Merge main into #5729
  • 09a7363 fix(mods): native_clock gives the clock as the world keeps it
  • d0135bf fix(mods): native_clock with then_some (clippy unnecessary_lazy_evaluations)

📊 Changes

2 files changed (+26 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/native_hooks.rs (+21 -0)
➕ tools/native-hook-fragments/native_clock.json (+5 -0)

📄 Description

Fixes #5728

🤖 Opened by Stink-O's AI agent (Claude Code, Claude Opus 5.5), not by Stink-O personally.

Part of making Orbital Laser native on Horizon (tracking: #5727); useful beyond it because a client mod can't read the time today.

What and why

native_get_clock() gives a client mod the world's game time and time of day in ticks (none on the title screen), as Level.getGameTime and getDayTime: for anything timed to the day, the sun or the world's own clock.

The API number comes from its fragment (tools/native-hook-fragments/).

Kind

  • feature

Vanilla reference

Level.getGameTime / getDayTime.

Other projects' code

none: the WebAssembly mod API's game.get-clock, which Horizon itself had before it dropped WebAssembly code mods.

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-SNGRNA4-LINUX, against origin/main at b6ac0602d, 2 min 26 s)

Check Result
Scope ✅ 2 files, +22 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 511 passed (29 s)
rustfmt ✅ (6 s)
Rust ⚠️ 1.97.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ❌ failed; likely the old Rust above (15 s)
tests: horizon-client ✅ 1635 passed (1 min 34 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
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)

Clippy fails here only on horizon-world/src/worldgen/aquifer/noise_based.rs (manual_range_contains), a lint new in
Rust 1.97 that fails on main too; with that one lint allowed it passes. Tests ran one at a time (RUST_TEST_THREADS=1):
in parallel a GPU test in horizon-client-render segfaults on this machine, on main too.

🤖 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/5729 **Author:** [@Stink-O](https://github.com/Stink-O) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `native/clock` --- ### 📝 Commits (4) - [`9dc99a5`](https://github.com/horizon-rust/horizon/commit/9dc99a5147270409e3510f37f62ca7823f2de83a) feat(mods): native mods can read the world's clock - [`54335a4`](https://github.com/horizon-rust/horizon/commit/54335a438d1430641a7ffd12534960f444c8e357) Merge main into #5729 - [`09a7363`](https://github.com/horizon-rust/horizon/commit/09a73636d07ee93e840d64c8cf11b91a401583b4) fix(mods): native_clock gives the clock as the world keeps it - [`d0135bf`](https://github.com/horizon-rust/horizon/commit/d0135bf3542b4fa12fa67f1ad5f6229552cd9624) fix(mods): native_clock with then_some (clippy unnecessary_lazy_evaluations) ### 📊 Changes **2 files changed** (+26 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/native_hooks.rs` (+21 -0) ➕ `tools/native-hook-fragments/native_clock.json` (+5 -0) </details> ### 📄 Description Fixes #5728 > 🤖 Opened by Stink-O's AI agent (Claude Code, Claude Opus 5.5), not by Stink-O personally. Part of making [Orbital Laser](https://github.com/Stink-O/orbital-laser) native on Horizon (tracking: #5727); useful beyond it because a client mod can't read the time today. ## What and why `native_get_clock()` gives a client mod the world's game time and time of day in ticks (none on the title screen), as `Level.getGameTime` and `getDayTime`: for anything timed to the day, the sun or the world's own clock. The API number comes from its fragment (`tools/native-hook-fragments/`). ## Kind - [x] feature ## Vanilla reference `Level.getGameTime` / `getDayTime`. ## Other projects' code none: the WebAssembly mod API's `game.get-clock`, which Horizon itself had before it dropped WebAssembly code mods. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-SNGRNA4-LINUX, against origin/main at b6ac0602d, 2 min 26 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +22 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 511 passed (29 s) | | rustfmt | ✅ (6 s) | | Rust | ⚠️ 1.97.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ❌ failed; likely the old Rust above (15 s) | | tests: horizon-client | ✅ 1635 passed (1 min 34 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | 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) | Clippy fails here only on `horizon-world/src/worldgen/aquifer/noise_based.rs` (`manual_range_contains`), a lint new in Rust 1.97 that fails on main too; with that one lint allowed it passes. Tests ran one at a time (`RUST_TEST_THREADS=1`): in parallel a GPU test in horizon-client-render segfaults on this machine, on main too. 🤖 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 06:21:05 +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#6463
No description provided.