[PR #6623] [MERGED] Native mods: login refusal, command list filter, sprint and resource pack status (part of #5816) #6991

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

📋 Pull Request Information

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

Base: main ← Head: feat-players-connection-hooks


📝 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
  • 69ce6f6 Merge current main into the Setup rebuild
  • ab3ebbd Native mods: a player swapping their hands, cancellable (native_player_swap_hands)
  • 4e70c05 Native mods: a player's food level changing, changeable (native_food_level_changed)
  • 8ac0773 Keep native mouse ownership when a second local player joins
  • a5da7ab Keep the native mouse regression fixture portable across filesystem paths
  • adea816 Merge current main into the Setup draft before localization fixes
  • b3dcefa Localize the splitscreen Setup screen and its window feedback

📊 Changes

82 files changed (+10461 additions, -1984 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/breathing.rs (+1 -1)
📝 crates/horizon-client/src/client_lib.rs (+4 -3)
📝 crates/horizon-client/src/crafting.rs (+1 -1)
📝 crates/horizon-client/src/entry.rs (+47 -0)
📝 crates/horizon-client/src/game.rs (+25 -6)
📝 crates/horizon-client/src/game/agent.rs (+9 -2)
📝 crates/horizon-client/src/game/commands.rs (+22 -0)
📝 crates/horizon-client/src/game/dedicated.rs (+1 -1)

...and 62 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 themed bundle of four player-side hooks, as agreed with the maintainers (up to about five related hooks per PR, each with its own proof, one API bump). Each is its own commit.

  • native_player_login(player, name, cancel, reason): heard in lan_process_events (HostEvent::Joined) after configuration, before the saved state is loaded and the player is placed; cancel kicks with reason and skips the join message and native_player_logged_in. Not heard: the connection-thread refusals (name, whitelist, ban, full server, proxy forwarding). The player is unplaced, so there is no native_tell; the refusal reason is the answer.
  • native_player_commands_sent(player, name, names): the root command names sent to a player, which a mod can filter (new Guest.hidden_commands, Hub::commands_packet); fires at join and on op or settings changes. Gap: the hub's own re-sends after a respawn or level change reuse the last answer.
  • native_player_sprint(player, name, sprinting): when the client starts or stops sprinting, through as_guest. Gap: sprints the server ends itself (knockback, hunger).
  • native_resource_pack_status(player, name, status): the client's answer to a server resource pack (status codes as vanilla's action), through as_guest. Gap: the pack offered during configuration is answered before the player has joined.

Kind

  • feature (four new native hook points, one commit each)

Vanilla reference

NeoForge PlayerNegotiationEvent (login); Commands/ClientboundCommandsPacket (no event; Paper's PlayerCommandSendEvent is the equivalent); ServerGamePacketListenerImpl.handlePlayerCommand and handleResourcePackResponse (Bukkit PlayerToggleSprintEvent, PlayerResourcePackStatusEvent).

Other projects' code

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

Proof on a real dedicated server

Engine from the batch branch these commits come from, plus a throwaway bundle with one helper per hook; one server run, one probe.

login:    the mod refuses the name Refused -> that client gets a Disconnect "you are not welcome"; control HookProbe is accepted
commands: the mod hides `list` for HookProbe -> its root commands lack `list` (other players still have it); after /op HookProbe the re-send is filtered again (91 roots, no `list`, `gamemode` present), acting=Some(player), native_tell sent=true; at join acting=None as documented
sprint:   START -> sprinting=true, STOP -> false, acting=Some(player), native_tell sent=true; control: START sent twice -> 0 hook lines on the second
pack:     status=0 and status=1 reach the hook, acting=Some(player), native_tell sent=true

Not covered: the gaps named above; the login proof covers only the mod-driven refusal, the sprint proof only client-driven start and stop, the resource-pack proof only play-state answers.

Self-check

pr_ready --quick --base upstream/main ran once on the whole branch that carries these hooks (16 files, +396 −9, five hooks): Python tests 586 passed, rustfmt, clippy, horizon-client tests 1806 passed, doc tests pass; parity not run (--quick). This PR is those commits cherry-picked onto current main (12 files changed, 287 insertions(+), 8 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/6623 **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-players-connection-hooks` --- ### 📝 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 - [`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) - [`4e70c05`](https://github.com/horizon-rust/horizon/commit/4e70c0549732dedd1ab50f4004b18b10984714a4) Native mods: a player's food level changing, changeable (native_food_level_changed) - [`8ac0773`](https://github.com/horizon-rust/horizon/commit/8ac07733050b65418c83772146e6e6bc3f7eda85) Keep native mouse ownership when a second local player joins - [`a5da7ab`](https://github.com/horizon-rust/horizon/commit/a5da7abce2db7a399dd3d8cfe004284f77f344ed) Keep the native mouse regression fixture portable across filesystem paths - [`adea816`](https://github.com/horizon-rust/horizon/commit/adea816573d33afa17d8843006bec63c23c8e828) Merge current main into the Setup draft before localization fixes - [`b3dcefa`](https://github.com/horizon-rust/horizon/commit/b3dcefa2ac3f6c02e06d45b165c0bc1252a9d01f) Localize the splitscreen Setup screen and its window feedback ### 📊 Changes **82 files changed** (+10461 additions, -1984 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/breathing.rs` (+1 -1) 📝 `crates/horizon-client/src/client_lib.rs` (+4 -3) 📝 `crates/horizon-client/src/crafting.rs` (+1 -1) 📝 `crates/horizon-client/src/entry.rs` (+47 -0) 📝 `crates/horizon-client/src/game.rs` (+25 -6) 📝 `crates/horizon-client/src/game/agent.rs` (+9 -2) 📝 `crates/horizon-client/src/game/commands.rs` (+22 -0) 📝 `crates/horizon-client/src/game/dedicated.rs` (+1 -1) _...and 62 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 themed bundle of four player-side hooks, as agreed with the maintainers (up to about five related hooks per PR, each with its own proof, one API bump). Each is its own commit. - `native_player_login(player, name, cancel, reason)`: heard in `lan_process_events` (`HostEvent::Joined`) after configuration, before the saved state is loaded and the player is placed; `cancel` kicks with `reason` and skips the join message and `native_player_logged_in`. Not heard: the connection-thread refusals (name, whitelist, ban, full server, proxy forwarding). The player is unplaced, so there is no `native_tell`; the refusal reason is the answer. - `native_player_commands_sent(player, name, names)`: the root command names sent to a player, which a mod can filter (new `Guest.hidden_commands`, `Hub::commands_packet`); fires at join and on op or settings changes. Gap: the hub's own re-sends after a respawn or level change reuse the last answer. - `native_player_sprint(player, name, sprinting)`: when the client starts or stops sprinting, through `as_guest`. Gap: sprints the server ends itself (knockback, hunger). - `native_resource_pack_status(player, name, status)`: the client's answer to a server resource pack (status codes as vanilla's action), through `as_guest`. Gap: the pack offered during configuration is answered before the player has joined. ## Kind - [x] feature (four new native hook points, one commit each) ## Vanilla reference NeoForge `PlayerNegotiationEvent` (login); `Commands`/`ClientboundCommandsPacket` (no event; Paper's `PlayerCommandSendEvent` is the equivalent); `ServerGamePacketListenerImpl.handlePlayerCommand` and `handleResourcePackResponse` (Bukkit `PlayerToggleSprintEvent`, `PlayerResourcePackStatusEvent`). ## Other projects' code none. (Tested with a throwaway horizon-mixins bundle, not part of this PR.) ## Proof on a real dedicated server Engine from the batch branch these commits come from, plus a throwaway bundle with one helper per hook; one server run, one probe. ``` login: the mod refuses the name Refused -> that client gets a Disconnect "you are not welcome"; control HookProbe is accepted commands: the mod hides `list` for HookProbe -> its root commands lack `list` (other players still have it); after /op HookProbe the re-send is filtered again (91 roots, no `list`, `gamemode` present), acting=Some(player), native_tell sent=true; at join acting=None as documented sprint: START -> sprinting=true, STOP -> false, acting=Some(player), native_tell sent=true; control: START sent twice -> 0 hook lines on the second pack: status=0 and status=1 reach the hook, acting=Some(player), native_tell sent=true ``` Not covered: the gaps named above; the login proof covers only the mod-driven refusal, the sprint proof only client-driven start and stop, the resource-pack proof only play-state answers. ## Self-check `pr_ready --quick --base upstream/main` ran once on the whole branch that carries these hooks (16 files, +396 −9, five hooks): Python tests 586 passed, rustfmt, clippy, `horizon-client` tests 1806 passed, doc tests pass; parity not run (`--quick`). This PR is those commits cherry-picked onto current main (12 files changed, 287 insertions(+), 8 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:31:04 +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#6991
No description provided.