From 891e1c12830ce848d799e0b8829bffc5832fcf04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Dr=C3=A4ger?= <20014538+sdraeger@users.noreply.github.com> Date: Sat, 24 Oct 2026 13:21:23 -0700 Subject: [PATCH] Run client mod hooks on the server thread --- crates/horizon-client/src/game/chat.rs | 8 +++++++- crates/horizon-client/src/game/remote.rs | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/game/chat.rs b/crates/horizon-client/src/game/chat.rs index f760bd82f..1bc30513b 100644 --- a/crates/horizon-client/src/game/chat.rs +++ b/crates/horizon-client/src/game/chat.rs @@ -570,8 +570,14 @@ impl Game<'_> { /// ChatScreen.handleChatInput: history, then a command or a chat line. pub(super) fn handle_chat_input(&mut self, message: &str) { self.ui.chat.add_recent(message); - // On a server (single player's own included) the server runs it. + // On a server (single player's own included) the server runs it, + // unless a client mod owns the command. if self.remote.is_some() { + if let Some(command) = message.strip_prefix('/') + && self.mod_command(command) + { + return; + } self.send_chat(message); return; } diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 32cffa306..23c6677c2 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -733,6 +733,9 @@ impl Game<'_> { self.ticks, self.screen == Screen::Chat, ); + if self.mods.running() { + self.mods_chat(&text); + } if let Some(r) = self.remote.as_mut() { r.chat.push((text, Instant::now())); r.chat_received += 1; @@ -3041,6 +3044,8 @@ impl Game<'_> { /// One client tick while connected (Minecraft.tick with a ClientLevel). pub(super) fn tick_remote(&mut self) -> Result<()> { self.tick_remote_level()?; + // Client mods tick on any server, single player's own included. + self.tick_mods(); // Minecraft.tick sends this even when the player cannot tick yet, // including while waiting for chunks. Keep it outside early returns. if self.remote.as_ref().is_some_and(|r| r.joined) {