[PR #5820] [MERGED] Native mods: a player respawning (native_player_respawned, part of #5816) #6509

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

📋 Pull Request Information

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

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


📝 Commits (2)

  • 8187bda Native mods: a player respawning (native_player_respawned)
  • 39b41a8 Merge main into #5820; the respawn hook fires once the player is placed, as them

📊 Changes

4 files changed (+31 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+5 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+8 -0)
📝 docs/native-mods.md (+6 -0)
➕ tools/native-hook-fragments/native_player_respawned.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 native mod could not hear a player respawning: native_player_died fires at death, but nothing at the moment the player comes back. Mods that give a kit, restore a state or log it need that moment.

  • New hook point native_player_respawned(player, name), API number from the fragment (tools/native-hook-fragments/native_player_respawned.json), a paragraph in docs/native-mods.md.
  • Called once from guest_respawn, after host.hub.respawn has put the player at their spawn point and reset health, food and experience, on a server. No player's state is swapped in, like native_player_died; the UUID goes to the helpers that take one.

Kind

  • feature (new native hook point)

Vanilla reference

NeoForge's PlayerEvent.PlayerRespawnEvent, fired at the end of PlayerList.respawn. Horizon's port is guest_respawn (lan_actions.rs).

Other projects' code

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

Proof on a real dedicated server

Engine built from this branch plus the branch of the other hook in #5816 (native_player_command) with a throwaway horizon-mixins bundle whose respawn helper prints a line. Fresh world, offline mode, a protocol client logs in, the console runs kill HookProbe, the client sends the respawn client command:

[mod] respawned HookProbe 334491f7944437a4b931afb3c36e5e2d

Without the bundle nothing is printed (the hook is an empty function). Not covered: a respawn in another dimension (bed or anchor elsewhere) takes the same path but I did not run it, and a respawn of the single player owner (not a server).

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on leoserver, against upstream/main at b4e123280, 8 min 26 s)

Check Result
Scope ✅ 4 files, +20 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 511 passed (45 s)
rustfmt ✅ (10 s)
clippy ✅ (3 min 10 s)
tests: horizon-client ✅ 1659 passed (4 min 17 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)

🔄 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/5820 **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-respawn-hook` --- ### 📝 Commits (2) - [`8187bda`](https://github.com/horizon-rust/horizon/commit/8187bdafaf70ca540d6dfd6ac7c4f5540645238e) Native mods: a player respawning (native_player_respawned) - [`39b41a8`](https://github.com/horizon-rust/horizon/commit/39b41a8d8570e427108d26297f40e7780b02e56b) Merge main into #5820; the respawn hook fires once the player is placed, as them ### 📊 Changes **4 files changed** (+31 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+5 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+8 -0) 📝 `docs/native-mods.md` (+6 -0) ➕ `tools/native-hook-fragments/native_player_respawned.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 native mod could not hear a player respawning: `native_player_died` fires at death, but nothing at the moment the player comes back. Mods that give a kit, restore a state or log it need that moment. - New hook point `native_player_respawned(player, name)`, API number from the fragment (`tools/native-hook-fragments/native_player_respawned.json`), a paragraph in `docs/native-mods.md`. - Called once from `guest_respawn`, after `host.hub.respawn` has put the player at their spawn point and reset health, food and experience, on a server. No player's state is swapped in, like `native_player_died`; the UUID goes to the helpers that take one. ## Kind - [x] feature (new native hook point) ## Vanilla reference NeoForge's `PlayerEvent.PlayerRespawnEvent`, fired at the end of `PlayerList.respawn`. Horizon's port is `guest_respawn` (`lan_actions.rs`). ## Other projects' code none. (Tested with a throwaway horizon-mixins bundle, not part of this PR.) ## Proof on a real dedicated server Engine built from this branch plus the branch of the other hook in #5816 (`native_player_command`) with a throwaway horizon-mixins bundle whose respawn helper prints a line. Fresh world, offline mode, a protocol client logs in, the console runs `kill HookProbe`, the client sends the respawn client command: ``` [mod] respawned HookProbe 334491f7944437a4b931afb3c36e5e2d ``` Without the bundle nothing is printed (the hook is an empty function). Not covered: a respawn in another dimension (bed or anchor elsewhere) takes the same path but I did not run it, and a respawn of the single player owner (not a server). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on leoserver, against upstream/main at b4e123280, 8 min 26 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +20 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 511 passed (45 s) | | rustfmt | ✅ (10 s) | | clippy | ✅ (3 min 10 s) | | tests: horizon-client | ✅ 1659 passed (4 min 17 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) | --- <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:47 +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#6509
No description provided.