[PR #1674] [MERGED] Client mods: tick, commands and chat on the server thread #3679

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1674
Author: @sdraeger
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: fix/client-mods-server-thread


📝 Commits (1)

  • 891e1c1 Run client mod hooks on the server thread

📊 Changes

2 files changed (+12 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/chat.rs (+7 -1)
📝 crates/horizon-client/src/game/remote.rs (+5 -0)

📄 Description

🤖 Opened by Simon's AI agent (Claude Code), not by Simon himself.

What and why

Fixes #1602. In single player on its server thread (the default since #1514), client mods never got their tick hook, their chat commands or the chat hook. The coords-hud example drew no panel and /where was "Unknown or incomplete command".

 tick_remote
   tick_remote_level
+  tick_mods                      # client mods tick on any server
   send ClientTickEnd

 handle_chat_input (remote)
+  if /command and a client mod owns it
+    mod_command; return
   send_chat

 chat_line                        # every chat line from the server
   ui.chat.add
+  mods_chat
   remote.chat.push

Three call sites, +12 lines. The in-frame path is unchanged. mod_command returns false for a vanilla command name (mods can't take those), so vanilla commands still go to the server.

Evidence

coords-hud, horizon-ctl launch --world R --seed 3 --creative --wait --dev-mod coords_hud.hmod, then /where:

  • Before (server thread): no panel; chat Unknown or incomplete command. See below for error / where<--[HERE]. --in-frame on the same build shows the panel and the line.
    before
  • After (server thread): panel shown, [Coordinates HUD] 0, 79, 0 in minecraft:overworld.
    after

cargo test -p horizon-mods --features runtime,pack: all pass.

One gap left: horizon-ctl messages reads the connection's chat on this path, so it doesn't list a mod's own chat.show lines (they go straight to the screen, as in-frame). Not changed here.

Vanilla reference

Horizon-only (the mod system).

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on Simons-MacBook-Pro, against upstream/main at fe128948b, 176 min 5 s)

Check Result
Scope ✅ 2 files, +12 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (3 s)
clippy ✅ (21 s)
tests: horizon-client ✅ 1199 passed (1 min 44 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 334 affected, 332 passed, failed: pack_screen, tab_list (173 min 55 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The two parity failures already exist upstream: python3 tools/parity.py pack_screen tab_list on upstream/main at fe12894, same Mac, fails with the same mismatches (text truncated one character apart, fills one pixel apart: 2778/3000 pack screens, 998/1000 player lists). Neither harness runs mod code.

Merge danger

Door: two-way. Blast radius: client mods only. With no mod running, mod_command, tick_mods and mods_chat return immediately.

🤖 Generated with 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/1674 **Author:** [@sdraeger](https://github.com/sdraeger) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/client-mods-server-thread` --- ### 📝 Commits (1) - [`891e1c1`](https://github.com/horizon-rust/horizon/commit/891e1c12830ce848d799e0b8829bffc5832fcf04) Run client mod hooks on the server thread ### 📊 Changes **2 files changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/chat.rs` (+7 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+5 -0) </details> ### 📄 Description > 🤖 Opened by Simon's AI agent (Claude Code), not by Simon himself. ## What and why Fixes #1602. In single player on its server thread (the default since #1514), client mods never got their `tick` hook, their chat commands or the chat hook. The coords-hud example drew no panel and `/where` was "Unknown or incomplete command". ```diff tick_remote tick_remote_level + tick_mods # client mods tick on any server send ClientTickEnd handle_chat_input (remote) + if /command and a client mod owns it + mod_command; return send_chat chat_line # every chat line from the server ui.chat.add + mods_chat remote.chat.push ``` Three call sites, +12 lines. The in-frame path is unchanged. `mod_command` returns false for a vanilla command name (mods can't take those), so vanilla commands still go to the server. ## Evidence coords-hud, `horizon-ctl launch --world R --seed 3 --creative --wait --dev-mod coords_hud.hmod`, then `/where`: - **Before** (server thread): no panel; chat `Unknown or incomplete command. See below for error` / `where<--[HERE]`. `--in-frame` on the same build shows the panel and the line. ![before](https://raw.githubusercontent.com/sdraeger/horizon/pr-assets/before-server-thread.png) - **After** (server thread): panel shown, `[Coordinates HUD] 0, 79, 0 in minecraft:overworld`. ![after](https://raw.githubusercontent.com/sdraeger/horizon/pr-assets/after-where.png) `cargo test -p horizon-mods --features runtime,pack`: all pass. One gap left: `horizon-ctl messages` reads the connection's chat on this path, so it doesn't list a mod's own `chat.show` lines (they go straight to the screen, as in-frame). Not changed here. ## Vanilla reference Horizon-only (the mod system). ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on Simons-MacBook-Pro, against upstream/main at fe128948b, 176 min 5 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +12 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (3 s) | | clippy | ✅ (21 s) | | tests: horizon-client | ✅ 1199 passed (1 min 44 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 334 affected, 332 passed, failed: pack_screen, tab_list (173 min 55 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The two parity failures already exist upstream: `python3 tools/parity.py pack_screen tab_list` on upstream/main at fe12894, same Mac, fails with the same mismatches (text truncated one character apart, fills one pixel apart: 2778/3000 pack screens, 998/1000 player lists). Neither harness runs mod code. ## Merge danger **Door:** two-way. **Blast radius:** client mods only. With no mod running, `mod_command`, `tick_mods` and `mods_chat` return immediately. 🤖 Generated with [Claude Code](https://claude.com/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 04:11:21 +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#3679
No description provided.