[PR #3582] [MERGED] Important fix: command blocks keep their command, suggest commands and dim the screen as vanilla #5072

Closed
opened 2026-11-03 05:10:02 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3582
Author: @Username59138
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/command-block-screen


📝 Commits (2)

  • 3451e4e Command blocks: keep the command in the edit screen, suggest as vanilla
  • 1332c90 Merge main into the branch; the command box types AltGr characters as main's other text boxes do

📊 Changes

7 files changed (+387 additions, -78 deletions)

View changed files

📝 crates/horizon-client-render/src/chat.rs (+177 -43)
📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/chat.rs (+1 -1)
📝 crates/horizon-client/src/game/command_blocks.rs (+180 -30)
📝 crates/horizon-client/src/game/control.rs (+8 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+6 -1)
📝 crates/horizon-client/src/game/remote.rs (+12 -2)

📄 Description

🤖 Opened by Username59138's AI agent (Claude), not by Username59138 themselves.

What and why

Important fix: command blocks barely worked in the default single player (the window is a client of its server thread), for LAN guests and on dedicated servers.

  • The command vanished from the edit screen. The chunk's update tag leaves a command block's command out, as in vanilla, so the client's copy of the block had an empty command: reopening a block showed an empty box, and pressing Done then wiped the block's real command on the server. Vanilla closes this with ServerPlayer.openCommandBlock, which sends the block's data (saveCustomOnly) to the player whose use opened it; Horizon had no such send. The server now sends it (lan_open_command_block, from as_guest like the lectern and sign editor), and the open screen refills from it (handleBlockEntityData → CommandBlockEditScreen.updateGui).
  • No command suggestions in the command box, while the chat has them. The chat's CommandSuggestions port now takes the constructor arguments as a SuggestLayout; the command box uses the ones AbstractCommandBlockEditScreen.init passes: commands without a leading / (commandsOnly), completions from the command's start (onlyShowIfCursorPastError), 7 lines under the box at y 72 (anchorToBottom false), fill 0x80000000. Argument colours, usage and error lines, Tab, arrows, mouse and wheel work as in the chat, and ask_server completions reach the box too.
  • The screen's background was the in-world menu background, nearly transparent. AbstractCommandBlockEditScreen.isInGameUi() is true, so vanilla draws only Screen.extractTransparentBackground's dimmed gradient (no blur).
  • horizon-ctl key presses now reach the command block screen (they went to gameplay), which made the above testable.

Vanilla reference

From the 26.3 jar (javap -c):

  • ServerPlayer.openCommandBlock, ClientPacketListener.handleBlockEntityData (refreshes an open CommandBlockEditScreen).
  • AbstractCommandBlockEditScreen.init: new CommandSuggestions(minecraft, this, commandEdit, font, true, true, 0, 7, false, Integer.MIN_VALUE); CommandSuggestions.updateCommandInfo, showSuggestions, SuggestionsList.<init> / extractRenderState, the usage drawing.
  • AbstractCommandBlockEditScreen.isInGameUi (returns true), Screen.extractBackground, Screen.extractTransparentBackground (0xC0101010 → 0xD0101010).

No parity harness covers these screens; checked in the game instead (below).

Checked in the game

Release build, server-thread single player, horizon-ctl on a scratch world:

  • a command set with /setblock … command_block{Command:"say hello from block"} shows in the screen when opened;
  • a command typed in the screen, Done, reopened: still there; a redstone block runs it ([Server] hello from block); still there after leaving and reloading the world;
  • an empty block opens with the command list under the box; gamemode cr shows creative, Tab completes it, then the selector list; gamemode cr shows Unknown game mode: cr at position 11;
  • the background is dimmed.

Self-check

pr_ready (tools/pr_ready.py --quick on gentoo-pc, against origin/main at 11494e17f, 3 min 6 s)

Check Result
Scope ✅ 8 files, +388 −77
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (36 s)
rustfmt ✅ (5 s)
clippy ✅ (39 s)
tests: horizon-client, horizon-client-render ✅ 1297 passed (1 min 14 s)
doc tests ✅ 0 passed (32 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)

🤖 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/3582 **Author:** [@Username59138](https://github.com/Username59138) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/command-block-screen` --- ### 📝 Commits (2) - [`3451e4e`](https://github.com/horizon-rust/horizon/commit/3451e4e29a9276326eb0c0dca2b38cf36ecef468) Command blocks: keep the command in the edit screen, suggest as vanilla - [`1332c90`](https://github.com/horizon-rust/horizon/commit/1332c9086835acaf5c375525eb168f4118736667) Merge main into the branch; the command box types AltGr characters as main's other text boxes do ### 📊 Changes **7 files changed** (+387 additions, -78 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chat.rs` (+177 -43) 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+1 -1) 📝 `crates/horizon-client/src/game/command_blocks.rs` (+180 -30) 📝 `crates/horizon-client/src/game/control.rs` (+8 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+6 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+12 -2) </details> ### 📄 Description > 🤖 Opened by Username59138's AI agent (Claude), not by Username59138 themselves. ## What and why **Important fix:** command blocks barely worked in the default single player (the window is a client of its server thread), for LAN guests and on dedicated servers. - **The command vanished from the edit screen.** The chunk's update tag leaves a command block's command out, as in vanilla, so the client's copy of the block had an empty command: reopening a block showed an empty box, and pressing Done then wiped the block's real command on the server. Vanilla closes this with `ServerPlayer.openCommandBlock`, which sends the block's data (`saveCustomOnly`) to the player whose use opened it; Horizon had no such send. The server now sends it (`lan_open_command_block`, from `as_guest` like the lectern and sign editor), and the open screen refills from it (`handleBlockEntityData` → `CommandBlockEditScreen.updateGui`). - **No command suggestions in the command box**, while the chat has them. The chat's `CommandSuggestions` port now takes the constructor arguments as a `SuggestLayout`; the command box uses the ones `AbstractCommandBlockEditScreen.init` passes: commands without a leading `/` (`commandsOnly`), completions from the command's start (`onlyShowIfCursorPastError`), 7 lines under the box at y 72 (`anchorToBottom` false), fill `0x80000000`. Argument colours, usage and error lines, Tab, arrows, mouse and wheel work as in the chat, and `ask_server` completions reach the box too. - **The screen's background** was the in-world menu background, nearly transparent. `AbstractCommandBlockEditScreen.isInGameUi()` is true, so vanilla draws only `Screen.extractTransparentBackground`'s dimmed gradient (no blur). - `horizon-ctl key` presses now reach the command block screen (they went to gameplay), which made the above testable. ## Vanilla reference From the 26.3 jar (`javap -c`): - `ServerPlayer.openCommandBlock`, `ClientPacketListener.handleBlockEntityData` (refreshes an open `CommandBlockEditScreen`). - `AbstractCommandBlockEditScreen.init`: `new CommandSuggestions(minecraft, this, commandEdit, font, true, true, 0, 7, false, Integer.MIN_VALUE)`; `CommandSuggestions.updateCommandInfo`, `showSuggestions`, `SuggestionsList.<init>` / `extractRenderState`, the usage drawing. - `AbstractCommandBlockEditScreen.isInGameUi` (returns true), `Screen.extractBackground`, `Screen.extractTransparentBackground` (`0xC0101010` → `0xD0101010`). No parity harness covers these screens; checked in the game instead (below). ## Checked in the game Release build, server-thread single player, `horizon-ctl` on a scratch world: - a command set with `/setblock … command_block{Command:"say hello from block"}` shows in the screen when opened; - a command typed in the screen, Done, reopened: still there; a redstone block runs it (`[Server] hello from block`); still there after leaving and reloading the world; - an empty block opens with the command list under the box; `gamemode cr` shows `creative`, Tab completes it, then the selector list; `gamemode cr ` shows `Unknown game mode: cr at position 11`; - the background is dimmed. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on gentoo-pc, against origin/main at 11494e17f, 3 min 6 s) | Check | Result | | --- | --- | | Scope | ✅ 8 files, +388 −77 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (36 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (39 s) | | tests: horizon-client, horizon-client-render | ✅ 1297 passed (1 min 14 s) | | doc tests | ✅ 0 passed (32 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) | 🤖 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 05:10:02 +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#5072
No description provided.