[PR #5770] [MERGED] Native mods: read redstone signal, light, weather, time, world height and stack size #6486

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

📋 Pull Request Information

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

Base: main ← Head: native-hooks


📝 Commits (4)

  • 14dcadd Native mods: read the redstone signal reaching a block (native_neighbor_signal)
  • bca8c9a Native mods: read light, weather, time of day, world height and stack sizes
  • 7239b38 Merge remote-tracking branch 'hr/main' into pr-5770
  • e7fedb9 World reads: no light in unloaded chunks, no weather outside the overworld, 26.3's clock name

📊 Changes

3 files changed (+69 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/native_hooks.rs (+57 -1)
➕ tools/native-hook-fragments/native_neighbor_signal.json (+6 -0)
➕ tools/native-hook-fragments/native_world_state.json (+6 -0)

📄 Description

🤖 Opened by d3xc0's AI agent (Claude Code), not by d3xc0 personally.

What and why

Fixes #5769.

Read-only helpers for native mods, so a mod's machines can read the world from a block entity's tick without reaching into Game internals:

  • native_neighbor_signal(dimension, pos): the strongest redstone signal reaching a block (SignalGetter.getBestNeighborSignal), 0 on a client and for another dimension
  • native_light(pos): block and sky light, 0 to 15
  • native_weather(): rain and thunder levels
  • native_day_time()
  • native_world_height(): min y and height
  • native_max_stack_size(item)

Each comes with a hook fragment (empty hooks, helper-only) per tools/native-hook-fragments/README.md. No new hook points, nothing changes for players. These are used by a Voltz remake for Horizon (https://github.com/d3xc0/voltz-horizon) for its explosives, solar panels, quarries and containers.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

SignalGetter.getBestNeighborSignal, Level.getBrightness (LightLayer.BLOCK / SKY), Level.getRainLevel, Level.getThunderLevel, Level.getDayTime, LevelHeightAccessor.getMinY / getHeight, Item.getDefaultMaxStackSize. Each helper wraps Horizon's existing implementation; no new behaviour.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on BLKHOST, against origin/main at 26747867d, 2 min 0 s)

Check Result
Scope ✅ 3 files, +58 −0
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 511 passed (1 min 4 s)
rustfmt ✅ (17 s)
Rust ⚠️ 1.95.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 (29 s)
tests: horizon-client ✅ 1655 passed (5 s)
doc tests ✅ 0 passed (4 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)

The clippy failure above is in horizon-world (untouched) with the older local Rust; cargo +stable clippy -p horizon-client --all-targets -- -D warnings on Rust 1.99.1 (CI's stable) passes with no warnings.

🤖 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/5770 **Author:** [@d3xc0](https://github.com/d3xc0) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `native-hooks` --- ### 📝 Commits (4) - [`14dcadd`](https://github.com/horizon-rust/horizon/commit/14dcadde70f6ef54aa7a2b1e7c71c4d84ebdcf7c) Native mods: read the redstone signal reaching a block (native_neighbor_signal) - [`bca8c9a`](https://github.com/horizon-rust/horizon/commit/bca8c9a0b80c05262de9b3b4fd0ff03e65cd2261) Native mods: read light, weather, time of day, world height and stack sizes - [`7239b38`](https://github.com/horizon-rust/horizon/commit/7239b38b1dcc8e7d60870d4f7484aa8c8ca89f1d) Merge remote-tracking branch 'hr/main' into pr-5770 - [`e7fedb9`](https://github.com/horizon-rust/horizon/commit/e7fedb9bc3fab640aac2012bcd391d4816f8834c) World reads: no light in unloaded chunks, no weather outside the overworld, 26.3's clock name ### 📊 Changes **3 files changed** (+69 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/native_hooks.rs` (+57 -1) ➕ `tools/native-hook-fragments/native_neighbor_signal.json` (+6 -0) ➕ `tools/native-hook-fragments/native_world_state.json` (+6 -0) </details> ### 📄 Description > 🤖 Opened by d3xc0's AI agent (Claude Code), not by d3xc0 personally. ## What and why Fixes #5769. Read-only helpers for native mods, so a mod's machines can read the world from a block entity's tick without reaching into `Game` internals: - `native_neighbor_signal(dimension, pos)`: the strongest redstone signal reaching a block (`SignalGetter.getBestNeighborSignal`), 0 on a client and for another dimension - `native_light(pos)`: block and sky light, 0 to 15 - `native_weather()`: rain and thunder levels - `native_day_time()` - `native_world_height()`: min y and height - `native_max_stack_size(item)` Each comes with a hook fragment (empty `hooks`, helper-only) per `tools/native-hook-fragments/README.md`. No new hook points, nothing changes for players. These are used by a Voltz remake for Horizon (https://github.com/d3xc0/voltz-horizon) for its explosives, solar panels, quarries and containers. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `SignalGetter.getBestNeighborSignal`, `Level.getBrightness` (`LightLayer.BLOCK` / `SKY`), `Level.getRainLevel`, `Level.getThunderLevel`, `Level.getDayTime`, `LevelHeightAccessor.getMinY` / `getHeight`, `Item.getDefaultMaxStackSize`. Each helper wraps Horizon's existing implementation; no new behaviour. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on BLKHOST, against origin/main at 26747867d, 2 min 0 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +58 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 511 passed (1 min 4 s) | | rustfmt | ✅ (17 s) | | Rust | ⚠️ 1.95.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 (29 s) | | tests: horizon-client | ✅ 1655 passed (5 s) | | doc tests | ✅ 0 passed (4 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) | The clippy failure above is in `horizon-world` (untouched) with the older local Rust; `cargo +stable clippy -p horizon-client --all-targets -- -D warnings` on Rust 1.99.1 (CI's stable) passes with no warnings. 🤖 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:22 +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#6486
No description provided.