[PR #6164] [MERGED] Native mods: a mod block catches fire, and a campfire smokes over it #6687

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6164
Author: @some-du6e
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: mods/fire-odds


📝 Commits (3)

  • 07b7fc0 Native mods: a mod block catches fire, and a campfire smokes over it
  • 1661021 Merge remote-tracking branch 'upstream/main' into t3/issue-5499
  • 5107acc Native mods: fire stands beside a block that only ignites; fuller hook docs

📊 Changes

8 files changed (+218 additions, -18 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+10 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+35 -0)
📝 crates/horizon-world/src/level/mod.rs (+11 -0)
📝 crates/horizon-world/src/level/place.rs (+2 -4)
📝 crates/horizon-world/src/level/shapes.rs (+1 -6)
📝 crates/horizon-world/src/level/survive.rs (+24 -8)
📝 crates/horizon-world/src/level/tests.rs (+121 -0)
➕ tools/native-hook-fragments/fire_odds.json (+14 -0)

📄 Description

What and why

Fixes #5499. Part of #4953.

A mod block couldn't say how it burns, and couldn't make a campfire's smoke rise higher. In vanilla, FireBlock.setFlammable(block, igniteOdds, burnOdds) sets how fast fire spreads to a block and how fast it destroys it, and CampfireBlock.isSmokeSource makes the block under a campfire turn it into a signal fire (a hay bale). This adds one hook for each, on GameLevel on an authoritative server, through LevelAccess the same way native_update_shape (#4899) works:

  • native_fire_odds(dimension, state, odds) answers FireBlock's table before vanilla's does: put (ignite, burn) in odds for your own blocks. Every rule that reads the table reads the answer: fire spreading into the air around the block, fire burning it out, fire standing beside it with nothing under it (isValidFireLocation), and fire burning out on a non-flammable floor at age 15. A waterlogged state still never burns and isn't asked, as in vanilla.
  • native_smoke_source(dimension, state, smoke) answers CampfireBlock.isSmokeSource before vanilla's hay-bale rule, both when a campfire is placed (getStateForPlacement) and when the block under it changes (updateShape), so signal_fire follows it.

A mod answers only for its own blocks and leaves the answer empty otherwise. The level is read-only. Without a mod nothing changes: the LevelAccess defaults do nothing, and the game's hooks are empty inline functions behind native_authoritative. The deprecated in-frame path fires neither. The hooks come in a fragment (tools/native-hook-fragments/fire_odds.json); the API number is stamped after merge.

Not covered, as with the sibling hooks: a client predicts a campfire it places, and flint and steel's fire faces, without the hooks, so for one round trip it may show the wrong signal_fire until the server's state arrives. The flame particles a client draws beside flammable blocks (FireBlock.animateTick, animate_tick.rs) still read vanilla's table, so they don't show beside a mod block. Burning itself is decided on the server and is correct.

Tested in the game

With an uncommitted test copy of this branch whose hooks answer for vanilla blocks: glass burns like wool ((30, 60)) and stone is a smoke source. White stained glass, which isn't hooked, is the control.

Check Server thread (single player) Dedicated server (--dedicated, a client joined)
Fire on netherrack, glass and stained glass beside it, 3000 ticks ✅ glass burned away, stained glass stays ✅ same
Fire set in mid-air beside glass / beside stained glass ✅ stays / goes out ✅ stays / goes out
Campfire placed by the player on stone / dirt / hay ✅ signal / none / signal ✅ signal / none / signal
Ground under a placed campfire: dirt → stone → hay → dirt ✅ none → signal → signal → none ✅ dirt → stone → dirt: none → signal → none

No panics or errors in any log. On the dedicated server the console checked each block (execute if block), and the joined client saw the same states.

Two level tests in horizon-world cover the same rules. a_level_can_answer_how_a_block_burns: glass given odds burns, planks given (0, 0) don't, fire in the air stays beside glass given (5, 0) and goes out beside plain glass, and burn odds of zero never destroy it. a_level_can_answer_what_makes_a_campfire_signal: a campfire placed and updated over stone and hay follows the level's answer either way. Both fail with the hook calls taken out. Like every level test, they skip without the prepared vanilla data, so CI only compiles them.

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

FireBlock.setFlammable, getIgniteOdds, getBurnOdds, canBurn, isValidFireLocation, checkBurnOut, tick; CampfireBlock.isSmokeSource, getStateForPlacement, updateShape. Names from NeoForge's public API: IBlockExtension.getFlammability / getFireSpreadSpeed cover the same ground there, as block subclass overrides.

Other projects' code

none

Self-check

pr_ready.py wasn't run: the machine is shared and too slow for it, so this PR's CI checks are the self-check. rustfmt and the public-tree check pass locally.

Note

Filed by Opus 5.5 using 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/6164 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `mods/fire-odds` --- ### 📝 Commits (3) - [`07b7fc0`](https://github.com/horizon-rust/horizon/commit/07b7fc0ad874d4fd02804833239ef7702bde90c9) Native mods: a mod block catches fire, and a campfire smokes over it - [`1661021`](https://github.com/horizon-rust/horizon/commit/16610216d456f60f055aa2036e9b06f441ab1367) Merge remote-tracking branch 'upstream/main' into t3/issue-5499 - [`5107acc`](https://github.com/horizon-rust/horizon/commit/5107acc191a7718555efdc64f43b037904b7da93) Native mods: fire stands beside a block that only ignites; fuller hook docs ### 📊 Changes **8 files changed** (+218 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+10 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+35 -0) 📝 `crates/horizon-world/src/level/mod.rs` (+11 -0) 📝 `crates/horizon-world/src/level/place.rs` (+2 -4) 📝 `crates/horizon-world/src/level/shapes.rs` (+1 -6) 📝 `crates/horizon-world/src/level/survive.rs` (+24 -8) 📝 `crates/horizon-world/src/level/tests.rs` (+121 -0) ➕ `tools/native-hook-fragments/fire_odds.json` (+14 -0) </details> ### 📄 Description ## What and why Fixes #5499. Part of #4953. A mod block couldn't say how it burns, and couldn't make a campfire's smoke rise higher. In vanilla, `FireBlock.setFlammable(block, igniteOdds, burnOdds)` sets how fast fire spreads to a block and how fast it destroys it, and `CampfireBlock.isSmokeSource` makes the block under a campfire turn it into a signal fire (a hay bale). This adds one hook for each, on `GameLevel` on an authoritative server, through `LevelAccess` the same way `native_update_shape` (#4899) works: - **`native_fire_odds(dimension, state, odds)`** answers `FireBlock`'s table before vanilla's does: put `(ignite, burn)` in `odds` for your own blocks. Every rule that reads the table reads the answer: fire spreading into the air around the block, fire burning it out, fire standing beside it with nothing under it (`isValidFireLocation`), and fire burning out on a non-flammable floor at age 15. A waterlogged state still never burns and isn't asked, as in vanilla. - **`native_smoke_source(dimension, state, smoke)`** answers `CampfireBlock.isSmokeSource` before vanilla's hay-bale rule, both when a campfire is placed (`getStateForPlacement`) and when the block under it changes (`updateShape`), so `signal_fire` follows it. A mod answers only for its own blocks and leaves the answer empty otherwise. The level is read-only. Without a mod nothing changes: the `LevelAccess` defaults do nothing, and the game's hooks are empty inline functions behind `native_authoritative`. The deprecated in-frame path fires neither. The hooks come in a fragment (`tools/native-hook-fragments/fire_odds.json`); the API number is stamped after merge. Not covered, as with the sibling hooks: a client predicts a campfire it places, and flint and steel's fire faces, without the hooks, so for one round trip it may show the wrong `signal_fire` until the server's state arrives. The flame particles a client draws beside flammable blocks (`FireBlock.animateTick`, `animate_tick.rs`) still read vanilla's table, so they don't show beside a mod block. Burning itself is decided on the server and is correct. ## Tested in the game With an uncommitted test copy of this branch whose hooks answer for vanilla blocks: glass burns like wool (`(30, 60)`) and stone is a smoke source. White stained glass, which isn't hooked, is the control. | Check | Server thread (single player) | Dedicated server (`--dedicated`, a client joined) | | --- | --- | --- | | Fire on netherrack, glass and stained glass beside it, 3000 ticks | ✅ glass burned away, stained glass stays | ✅ same | | Fire set in mid-air beside glass / beside stained glass | ✅ stays / goes out | ✅ stays / goes out | | Campfire placed by the player on stone / dirt / hay | ✅ signal / none / signal | ✅ signal / none / signal | | Ground under a placed campfire: dirt → stone → hay → dirt | ✅ none → signal → signal → none | ✅ dirt → stone → dirt: none → signal → none | No panics or errors in any log. On the dedicated server the console checked each block (`execute if block`), and the joined client saw the same states. Two level tests in horizon-world cover the same rules. `a_level_can_answer_how_a_block_burns`: glass given odds burns, planks given `(0, 0)` don't, fire in the air stays beside glass given `(5, 0)` and goes out beside plain glass, and burn odds of zero never destroy it. `a_level_can_answer_what_makes_a_campfire_signal`: a campfire placed and updated over stone and hay follows the level's answer either way. Both fail with the hook calls taken out. Like every level test, they skip without the prepared vanilla data, so CI only compiles them. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [x] 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 `FireBlock.setFlammable`, `getIgniteOdds`, `getBurnOdds`, `canBurn`, `isValidFireLocation`, `checkBurnOut`, `tick`; `CampfireBlock.isSmokeSource`, `getStateForPlacement`, `updateShape`. Names from NeoForge's public API: `IBlockExtension.getFlammability` / `getFireSpreadSpeed` cover the same ground there, as block subclass overrides. ## Other projects' code none ## Self-check `pr_ready.py` wasn't run: the machine is shared and too slow for it, so this PR's CI checks are the self-check. rustfmt and the public-tree check pass locally. > [!NOTE] > Filed by Opus 5.5 using 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:24:56 +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#6687
No description provided.