[PR #6653] [MERGED] Native mods: TNT about to be lit, cancellable (native_tnt_primed, part of #5816) #7014

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6653
Author: @Detimes
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: feat-tnt-hook


📝 Commits (10+)

  • 8a65c97 Merge the profiles prerequisite onto current main for Setup
  • d48b592 Splitscreen: arrange players with a Setup map and Apply/Revert
  • fb0496a Align Setup pause icons and seed the saved switch in live checks
  • 4d0553b Add native_armor_stand_manipulate hook
  • 3139a6b Add native_vehicle_moved hook
  • 69af122 Add native_container_opened hook
  • 69096a5 Add native_creative_slot hook
  • 78295e8 Merge upstream/main: keep both hooks
  • 69ce6f6 Merge current main into the Setup rebuild
  • ab3ebbd Native mods: a player swapping their hands, cancellable (native_player_swap_hands)

📊 Changes

63 files changed (+3940 additions, -140 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk.rs (+12 -6)
📝 crates/horizon-client-render/src/lib.rs (+2 -0)
📝 crates/horizon-client-render/src/mesher.rs (+15 -19)
📝 crates/horizon-client-render/src/mesher/reuse_tests.rs (+60 -1)
📝 crates/horizon-client-render/src/mesher/sides.rs (+5 -4)
📝 crates/horizon-client-render/src/options_ui.rs (+32 -12)
📝 crates/horizon-client-render/src/split_layout.rs (+487 -25)
➕ crates/horizon-client-render/src/split_map.rs (+166 -0)
➕ crates/horizon-client-render/src/split_ui.rs (+716 -0)
📝 crates/horizon-client/assets/horizon/lang/en_us.json (+31 -2)
📝 crates/horizon-client/assets/horizon/lang/fr_fr.json (+35 -6)
📝 crates/horizon-client/src/benchmark.rs (+90 -1)
📝 crates/horizon-client/src/client_lib.rs (+3 -3)
📝 crates/horizon-client/src/game.rs (+50 -8)
📝 crates/horizon-client/src/game/agent.rs (+9 -2)
📝 crates/horizon-client/src/game/armor_stands.rs (+17 -0)
📝 crates/horizon-client/src/game/commands.rs (+22 -0)
📝 crates/horizon-client/src/game/creatures.rs (+5 -3)
📝 crates/horizon-client/src/game/dedicated.rs (+1 -1)
📝 crates/horizon-client/src/game/dispenser.rs (+6 -2)

...and 43 more files

📄 Description

🤖 Opened by Detimes' AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally.

What and why

Part of #5816 (hook points a survival server's native mods need). A mod could not hear or refuse TNT being lit (grief protection, arenas).

  • New hook point native_tnt_primed(player, pos, cancel) (fragment native_tnt_primed.json, docs paragraph). tnt_prime_allowed (tnt.rs) asks the mods before TNT is primed; the acting guest, if any, is player. Covered: flint and steel / fire charge (tnt.rs), a fire or redstone level event (prime_tnt_event, which puts the TNT block back when the mods refuse), a projectile or entity ignition (creatures.rs) and a dispenser (dispenser.rs).
  • cancel keeps the block and primes nothing. Nothing changes when no mod hooks it.

Kind

  • feature (new native hook point)

Vanilla reference

TntBlock.explode / PrimedTnt; NeoForge/Bukkit: TNTPrimeEvent.

Other projects' code

none. (Tested with a throwaway horizon-mixins bundle, not part of this PR.)

Proof on a real dedicated server

Proof on a real dedicated server, run on the batch branch this was cut from (before it was ported to current main: spawn_primed_tnt and add_primed_tnt gained owner arguments upstream, so the call sites changed); throwaway horizon-mixins bundle, helpers show native_acting_player=Some(..) native_tell=true.

phase A (listen):  flint and steel on TNT -> primed TNT, block gone, tnt_primed player=Some(..) pos=[3,200,26]; redstone block next to TNT -> primed, tnt_primed player=None
phase B (cancel):  flint and steel -> tnt_primed cancel=true, no primed TNT, the TNT block stays; redstone -> same

After the port: cargo check and cargo test -p horizon-client native_hooks (catalog) pass on current main; the live run was not repeated on the ported tree.

Not covered: a live rerun after the port to current main, TNT minecarts, the LAN host as a player.

Self-check

pr_ready --quick was not run on this cut; the batch branch it comes from built and was probed. This PR is those commits cherry-picked onto current main (7 files changed, 78 insertions(+), 6 deletions(-)): cargo test -p horizon-client native_hooks passes (21 passed).


🔄 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/6653 **Author:** [@Detimes](https://github.com/Detimes) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat-tnt-hook` --- ### 📝 Commits (10+) - [`8a65c97`](https://github.com/horizon-rust/horizon/commit/8a65c97f3b2ee6a1f2536db6faa2bedbca5f62a8) Merge the profiles prerequisite onto current main for Setup - [`d48b592`](https://github.com/horizon-rust/horizon/commit/d48b592ddde908a6ccba643cc27d1411bbdebd95) Splitscreen: arrange players with a Setup map and Apply/Revert - [`fb0496a`](https://github.com/horizon-rust/horizon/commit/fb0496a105f785cfb7e9165d3c228935161e9a6f) Align Setup pause icons and seed the saved switch in live checks - [`4d0553b`](https://github.com/horizon-rust/horizon/commit/4d0553be6ea6c79866eb038e721ed693eb5228b1) Add native_armor_stand_manipulate hook - [`3139a6b`](https://github.com/horizon-rust/horizon/commit/3139a6b8c049c55c1f4e9f508ee3badab42ec49c) Add native_vehicle_moved hook - [`69af122`](https://github.com/horizon-rust/horizon/commit/69af122b0d05f249b3d1ed443f145285c07e5b05) Add native_container_opened hook - [`69096a5`](https://github.com/horizon-rust/horizon/commit/69096a58772f0f433c25502a599cd12e4faaef4c) Add native_creative_slot hook - [`78295e8`](https://github.com/horizon-rust/horizon/commit/78295e840f5f336b6a82c93f545a3566b84d11ff) Merge upstream/main: keep both hooks - [`69ce6f6`](https://github.com/horizon-rust/horizon/commit/69ce6f6c2635ceb282e0d8ea9dfc0bf2197286d0) Merge current main into the Setup rebuild - [`ab3ebbd`](https://github.com/horizon-rust/horizon/commit/ab3ebbdd653d3348ff6e56460eabff0493dcbfd9) Native mods: a player swapping their hands, cancellable (native_player_swap_hands) ### 📊 Changes **63 files changed** (+3940 additions, -140 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk.rs` (+12 -6) 📝 `crates/horizon-client-render/src/lib.rs` (+2 -0) 📝 `crates/horizon-client-render/src/mesher.rs` (+15 -19) 📝 `crates/horizon-client-render/src/mesher/reuse_tests.rs` (+60 -1) 📝 `crates/horizon-client-render/src/mesher/sides.rs` (+5 -4) 📝 `crates/horizon-client-render/src/options_ui.rs` (+32 -12) 📝 `crates/horizon-client-render/src/split_layout.rs` (+487 -25) ➕ `crates/horizon-client-render/src/split_map.rs` (+166 -0) ➕ `crates/horizon-client-render/src/split_ui.rs` (+716 -0) 📝 `crates/horizon-client/assets/horizon/lang/en_us.json` (+31 -2) 📝 `crates/horizon-client/assets/horizon/lang/fr_fr.json` (+35 -6) 📝 `crates/horizon-client/src/benchmark.rs` (+90 -1) 📝 `crates/horizon-client/src/client_lib.rs` (+3 -3) 📝 `crates/horizon-client/src/game.rs` (+50 -8) 📝 `crates/horizon-client/src/game/agent.rs` (+9 -2) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+17 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+22 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+5 -3) 📝 `crates/horizon-client/src/game/dedicated.rs` (+1 -1) 📝 `crates/horizon-client/src/game/dispenser.rs` (+6 -2) _...and 43 more files_ </details> ### 📄 Description > 🤖 Opened by Detimes' AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally. ## What and why Part of #5816 (hook points a survival server's native mods need). A mod could not hear or refuse TNT being lit (grief protection, arenas). - New hook point `native_tnt_primed(player, pos, cancel)` (fragment `native_tnt_primed.json`, docs paragraph). `tnt_prime_allowed` (`tnt.rs`) asks the mods before TNT is primed; the acting guest, if any, is `player`. Covered: flint and steel / fire charge (`tnt.rs`), a fire or redstone level event (`prime_tnt_event`, which puts the TNT block back when the mods refuse), a projectile or entity ignition (`creatures.rs`) and a dispenser (`dispenser.rs`). - `cancel` keeps the block and primes nothing. Nothing changes when no mod hooks it. ## Kind - [x] feature (new native hook point) ## Vanilla reference `TntBlock.explode` / `PrimedTnt`; NeoForge/Bukkit: `TNTPrimeEvent`. ## Other projects' code none. (Tested with a throwaway horizon-mixins bundle, not part of this PR.) ## Proof on a real dedicated server Proof on a real dedicated server, run on the batch branch this was cut from (before it was ported to current main: `spawn_primed_tnt` and `add_primed_tnt` gained owner arguments upstream, so the call sites changed); throwaway horizon-mixins bundle, helpers show `native_acting_player=Some(..) native_tell=true`. ``` phase A (listen): flint and steel on TNT -> primed TNT, block gone, tnt_primed player=Some(..) pos=[3,200,26]; redstone block next to TNT -> primed, tnt_primed player=None phase B (cancel): flint and steel -> tnt_primed cancel=true, no primed TNT, the TNT block stays; redstone -> same ``` After the port: `cargo check` and `cargo test -p horizon-client native_hooks` (catalog) pass on current main; the live run was not repeated on the ported tree. Not covered: a live rerun after the port to current main, TNT minecarts, the LAN host as a player. ## Self-check `pr_ready --quick` was not run on this cut; the batch branch it comes from built and was probed. This PR is those commits cherry-picked onto current main (7 files changed, 78 insertions(+), 6 deletions(-)): `cargo test -p horizon-client native_hooks` passes (21 passed). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:32:07 +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#7014
No description provided.