[PR #3952] [MERGED] Signs run the click commands in their text, as vanilla #5317

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

📋 Pull Request Information

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

Base: main ← Head: fix/split-shelves-signs


📝 Commits (4)

  • 04fb868 Keep click events and allow_op_features on loaded signs
  • 37f9481 Add SignText.hasAnyClickCommands for a sign side
  • 2d477df Let a waxed sign with a click command stop hanging signs chaining
  • 753660c Run the click command of a sign when a player uses it

📊 Changes

6 files changed (+238 additions, -14 deletions)

View changed files

📝 crates/horizon-client-render/src/block_entity_render.rs (+1 -0)
📝 crates/horizon-client-render/src/chunk/block_entity.rs (+4 -0)
📝 crates/horizon-client-render/src/signs.rs (+87 -4)
📝 crates/horizon-client/src/game.rs (+4 -2)
📝 crates/horizon-client/src/game/commands/extra.rs (+18 -1)
📝 crates/horizon-client/src/game/sign_edit.rs (+124 -7)

📄 Description

What and why

  • Signs keep each line's click event and the allow_op_features flag when loaded and saved. Before, every line was flattened to plain text, so a click event was lost the moment a sign loaded, and an edited line lost its style.
  • A sign side can say whether its text has a run_command click event (has_any_click_commands), and a waxed sign with one can run it (can_execute_click_commands). Before, a sign side could not answer this.
  • A hanging sign used on another hanging sign no longer chains below it when the aimed sign is waxed and has a click command to run. Before, it always chained.
  • Using a sign with a run_command in its text runs the command as the player, from the block centre, at permission level 2, with no output. show_dialog opens its dialog and a custom action is logged. This only works when the sign has allow_op_features; otherwise the action bar says click actions are disabled. A waxed sign still plays its failed-interaction sound, and a sign that ran a command does not open the editor. Before, clicking such a sign did nothing.

The shelf commits of this group (block entity, sync, item drawing, single and powered-chain swap, right mouse button) were left out: main already has all of them in game/shelf.rs and the Shelf block entity.

Vanilla reference

  • Click events and allow_op_features kept on load and save: SignBlockEntity.updateMessages, SignBlockEntity.loadAdditional and saveAdditional, SignBlockEntity.java.
  • Sign side click commands: SignText.hasAnyClickCommands, SignText.java:120, and ClickEvent.CODEC.
  • Hanging sign chaining: SignBlockEntity.canExecuteClickCommands, SignBlockEntity.java:178; CeilingHangingSignBlock.shouldTryToChainAnotherHangingSign and WallHangingSignBlock.shouldTryToChainAnotherHangingSign.
  • Running the click command: SignBlock.useWithoutItem and SignBlock.useItemOn call SignBlockEntity.executeClickCommandsIfPresent, SignBlockEntity.java:182, which uses createCommandSourceStack with CommandSource.NULL.

Self-check

rustfmt on changed files; built by CI; not run in game.

Split out of #3926.


🔄 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/3952 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/split-shelves-signs` --- ### 📝 Commits (4) - [`04fb868`](https://github.com/horizon-rust/horizon/commit/04fb868e998ed85f8c6a5dc7dd824dfae80fda14) Keep click events and allow_op_features on loaded signs - [`37f9481`](https://github.com/horizon-rust/horizon/commit/37f9481bb76763ca79c180c9a604e3705c9889af) Add SignText.hasAnyClickCommands for a sign side - [`2d477df`](https://github.com/horizon-rust/horizon/commit/2d477df4fdf1bf1430eaf5d085c64efb87bf2f62) Let a waxed sign with a click command stop hanging signs chaining - [`753660c`](https://github.com/horizon-rust/horizon/commit/753660c0b420223f6d939a4021ad974d7f3bfcea) Run the click command of a sign when a player uses it ### 📊 Changes **6 files changed** (+238 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/block_entity_render.rs` (+1 -0) 📝 `crates/horizon-client-render/src/chunk/block_entity.rs` (+4 -0) 📝 `crates/horizon-client-render/src/signs.rs` (+87 -4) 📝 `crates/horizon-client/src/game.rs` (+4 -2) 📝 `crates/horizon-client/src/game/commands/extra.rs` (+18 -1) 📝 `crates/horizon-client/src/game/sign_edit.rs` (+124 -7) </details> ### 📄 Description ## What and why - Signs keep each line's click event and the `allow_op_features` flag when loaded and saved. Before, every line was flattened to plain text, so a click event was lost the moment a sign loaded, and an edited line lost its style. - A sign side can say whether its text has a `run_command` click event (`has_any_click_commands`), and a waxed sign with one can run it (`can_execute_click_commands`). Before, a sign side could not answer this. - A hanging sign used on another hanging sign no longer chains below it when the aimed sign is waxed and has a click command to run. Before, it always chained. - Using a sign with a `run_command` in its text runs the command as the player, from the block centre, at permission level 2, with no output. `show_dialog` opens its dialog and a custom action is logged. This only works when the sign has `allow_op_features`; otherwise the action bar says click actions are disabled. A waxed sign still plays its failed-interaction sound, and a sign that ran a command does not open the editor. Before, clicking such a sign did nothing. The shelf commits of this group (block entity, sync, item drawing, single and powered-chain swap, right mouse button) were left out: main already has all of them in `game/shelf.rs` and the Shelf block entity. ## Vanilla reference - Click events and `allow_op_features` kept on load and save: `SignBlockEntity.updateMessages`, `SignBlockEntity.loadAdditional` and `saveAdditional`, `SignBlockEntity.java`. - Sign side click commands: `SignText.hasAnyClickCommands`, `SignText.java:120`, and `ClickEvent.CODEC`. - Hanging sign chaining: `SignBlockEntity.canExecuteClickCommands`, `SignBlockEntity.java:178`; `CeilingHangingSignBlock.shouldTryToChainAnotherHangingSign` and `WallHangingSignBlock.shouldTryToChainAnotherHangingSign`. - Running the click command: `SignBlock.useWithoutItem` and `SignBlock.useItemOn` call `SignBlockEntity.executeClickCommandsIfPresent`, `SignBlockEntity.java:182`, which uses `createCommandSourceStack` with `CommandSource.NULL`. ## Self-check rustfmt on changed files; built by CI; not run in game. Split out of #3926. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:44 +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#5317
No description provided.