[PR #6306] [MERGED] Native mods: a player changing dimension (native_player_changed_dimension, part of #5816) #6784

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

📋 Pull Request Information

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

Base: main ← Head: feat-player-dimension-hook


📝 Commits (3)

  • b244d53 Native mods: a player changing dimension (native_player_changed_dimension)
  • 9fabb5b Merge upstream/main: respawn hook and dimension hook both at the end of guest_respawn
  • 0e9f118 Merge main into #6306

📊 Changes

5 files changed (+102 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+12 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+27 -0)
📝 crates/horizon-client/src/game/server_travel.rs (+43 -1)
📝 docs/native-mods.md (+8 -0)
➕ tools/native-hook-fragments/native_player_changed_dimension.json (+12 -0)

📄 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 a player arriving in another dimension.

  • New hook point native_player_changed_dimension(player, name, from, to) (fragment native_player_changed_dimension.json with neoforge: PlayerEvent.PlayerChangedDimensionEvent, docs paragraph).
  • Game::tell_mods_changed_dimension (server_travel.rs) calls it inside as_guest, when the trip ends, not when the move starts (Trip got a left: Option<Dim>): portals (also riding, and leaving the End as winner), command teleports (/execute in … run tp), and a respawn in another dimension than the death's (at once, or on arrival of the respawn trip). Nothing fires for a move that ends where it started, a player who leaves mid-trip, or an End gateway.
  • Nothing changes when no mod hooks it.

Kind

  • feature (new native hook point)

Vanilla reference

NeoForge's PlayerEvent.PlayerChangedDimensionEvent.

Other projects' code

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

Proof on a real dedicated server

control: plain tp inside the overworld            -> hook lines: 0
execute in the_nether run tp                      -> from=overworld to=the_nether, acting player Some(player), native_tell sent=true, client got the chat line
control: tp inside the nether                     -> hook lines: 0
execute in overworld run tp                       -> from=the_nether to=overworld
execute in the_end run tp                         -> from=overworld to=the_end
die in the end, respawn in the overworld          -> from=the_end to=overworld

Not exercised: a real portal walk-in (Nether or End portal, riding, End winner) and respawns at a bed or anchor in another level, including the world-spawn fallback; those are code-reviewed only.

Self-check

pr_ready --quick --base upstream/main before merging main: Public tree, Python tests, rustfmt, clippy, horizon-client tests (1668 passed) pass; parity not run (--quick). Merging main conflicted with the maintainers' respawn hook in guest_respawn; both now sit at its end (theirs first). After the merge: cargo check and cargo test -p horizon-client --bin horizon-client native_hooks::tests (20 tests) pass.


🔄 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/6306 **Author:** [@Detimes](https://github.com/Detimes) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat-player-dimension-hook` --- ### 📝 Commits (3) - [`b244d53`](https://github.com/horizon-rust/horizon/commit/b244d5354abd8fd3ae07912c727cd5e32ab68d75) Native mods: a player changing dimension (native_player_changed_dimension) - [`9fabb5b`](https://github.com/horizon-rust/horizon/commit/9fabb5b74c8756a765ebf7f58083ba8c3ab1819d) Merge upstream/main: respawn hook and dimension hook both at the end of guest_respawn - [`0e9f118`](https://github.com/horizon-rust/horizon/commit/0e9f118caac717e4e1716d0782bf22dfcfaf2c74) Merge main into #6306 ### 📊 Changes **5 files changed** (+102 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+12 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+27 -0) 📝 `crates/horizon-client/src/game/server_travel.rs` (+43 -1) 📝 `docs/native-mods.md` (+8 -0) ➕ `tools/native-hook-fragments/native_player_changed_dimension.json` (+12 -0) </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 a player arriving in another dimension. - New hook point `native_player_changed_dimension(player, name, from, to)` (fragment `native_player_changed_dimension.json` with `neoforge: PlayerEvent.PlayerChangedDimensionEvent`, docs paragraph). - `Game::tell_mods_changed_dimension` (server_travel.rs) calls it inside `as_guest`, when the trip ends, not when the move starts (`Trip` got a `left: Option<Dim>`): portals (also riding, and leaving the End as winner), command teleports (`/execute in … run tp`), and a respawn in another dimension than the death's (at once, or on arrival of the respawn trip). Nothing fires for a move that ends where it started, a player who leaves mid-trip, or an End gateway. - Nothing changes when no mod hooks it. ## Kind - [x] feature (new native hook point) ## Vanilla reference NeoForge's `PlayerEvent.PlayerChangedDimensionEvent`. ## Other projects' code none. (Tested with a throwaway horizon-mixins bundle, not part of this PR.) ## Proof on a real dedicated server ``` control: plain tp inside the overworld -> hook lines: 0 execute in the_nether run tp -> from=overworld to=the_nether, acting player Some(player), native_tell sent=true, client got the chat line control: tp inside the nether -> hook lines: 0 execute in overworld run tp -> from=the_nether to=overworld execute in the_end run tp -> from=overworld to=the_end die in the end, respawn in the overworld -> from=the_end to=overworld ``` Not exercised: a real portal walk-in (Nether or End portal, riding, End winner) and respawns at a bed or anchor in another level, including the world-spawn fallback; those are code-reviewed only. ## Self-check `pr_ready --quick --base upstream/main` before merging main: Public tree, Python tests, rustfmt, clippy, `horizon-client` tests (1668 passed) pass; parity not run (`--quick`). Merging main conflicted with the maintainers' respawn hook in `guest_respawn`; both now sit at its end (theirs first). After the merge: `cargo check` and `cargo test -p horizon-client --bin horizon-client native_hooks::tests` (20 tests) pass. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:26:35 +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#6784
No description provided.