[PR #3655] [MERGED] Add the Debug Stick #5128

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

📋 Pull Request Information

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

Base: main ← Head: feat/debug-stick


📝 Commits (4)

  • 37a2cc0 Add the Debug Stick
  • 4592a7e Merge remote-tracking branch 'origin/main' into upd-3655
  • 57e49b0 Merge remote-tracking branch 'origin/main' into upd-3655
  • bc31cef Merge main into feat/debug-stick (no conflicts)

📊 Changes

7 files changed (+325 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+24 -0)
➕ crates/horizon-client/src/game/debug_stick.rs (+187 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+13 -0)
📝 crates/horizon-client/src/game/remote.rs (+26 -3)
📝 crates/horizon-items/src/item_data.rs (+50 -0)
📝 crates/horizon-world/src/registry.rs (+21 -0)
📝 tests/test_remote_mining.py (+4 -2)

📄 Description

Opened by jaszkus's AI agent, not by jaszkus himself.

What and why

Adds the vanilla Debug Stick: in creative with game-master permissions, a left click selects the next block-state property, a right click cycles the selected property's value, and Shift reverses either direction. The selection lives in the minecraft:debug_stick_state component (block id to property name), so it stays with the stack and saves like any other component.

The client never breaks the block with it and swings when the stick is used; the server cycles the state and sends the block update. Properties follow the sorted state-property order and values follow the block-state registry order, as DebugStickItem does.

The interaction also follows the acting player: Shift uses the player's sneak state (isShiftKeyDown, so toggled sneak and LAN guests work, not the host's physical Shift keys), a guest's command permission is swapped for its turn so canUseGameMasterBlocks sees the guest's own level, and useOn returns the vanilla SUCCESS/FAIL. A successful use triggers ITEM_USED_ON_BLOCK; a failed one cycles nothing, and only the local actor's client swings (a remote guest swings in its own client).

Verified in game in creative: selected and cycled facing, half, shape, waterlogged and others on stairs, slabs, fences, doors and candles; Shift reverses; the new state reaches the client.

Vanilla reference

DebugStickItem (useOn, canDestroyBlock, handleInteraction, cycleState, getRelative), DebugStickState, Util.findNextInIterable / findPreviousInIterable, the possible-value order of BooleanProperty / EnumProperty, Player.isSecondaryUseActive / isShiftKeyDown, Player.canUseGameMasterBlocks (ServerPlayer.permissions), and ServerPlayerGameMode.useItemOn (ITEM_USED_ON_BLOCK). Unit tests cover the state component and the wrapping order; no parity harness (the behaviour is a server block-state change plus a component).

Self-check

Not run locally; CI's verify and parity jobs cover the branch.


🔄 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/3655 **Author:** [@jaszkus](https://github.com/jaszkus) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `feat/debug-stick` --- ### 📝 Commits (4) - [`37a2cc0`](https://github.com/horizon-rust/horizon/commit/37a2cc0057ba842ab0c5a2f4735ad24262b82df3) Add the Debug Stick - [`4592a7e`](https://github.com/horizon-rust/horizon/commit/4592a7e79917fbe6c06ab6e6eda7591503d86910) Merge remote-tracking branch 'origin/main' into upd-3655 - [`57e49b0`](https://github.com/horizon-rust/horizon/commit/57e49b068e98beb7c4b4568833396b2882a969cc) Merge remote-tracking branch 'origin/main' into upd-3655 - [`bc31cef`](https://github.com/horizon-rust/horizon/commit/bc31cef0a7d4000b7e373bb8d422b0cc4c57d6cd) Merge main into feat/debug-stick (no conflicts) ### 📊 Changes **7 files changed** (+325 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+24 -0) ➕ `crates/horizon-client/src/game/debug_stick.rs` (+187 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+13 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+26 -3) 📝 `crates/horizon-items/src/item_data.rs` (+50 -0) 📝 `crates/horizon-world/src/registry.rs` (+21 -0) 📝 `tests/test_remote_mining.py` (+4 -2) </details> ### 📄 Description Opened by jaszkus's AI agent, not by jaszkus himself. ## What and why Adds the vanilla Debug Stick: in creative with game-master permissions, a left click selects the next block-state property, a right click cycles the selected property's value, and Shift reverses either direction. The selection lives in the `minecraft:debug_stick_state` component (block id to property name), so it stays with the stack and saves like any other component. The client never breaks the block with it and swings when the stick is used; the server cycles the state and sends the block update. Properties follow the sorted state-property order and values follow the block-state registry order, as `DebugStickItem` does. The interaction also follows the acting player: Shift uses the player's sneak state (`isShiftKeyDown`, so toggled sneak and LAN guests work, not the host's physical Shift keys), a guest's command permission is swapped for its turn so `canUseGameMasterBlocks` sees the guest's own level, and `useOn` returns the vanilla SUCCESS/FAIL. A successful use triggers `ITEM_USED_ON_BLOCK`; a failed one cycles nothing, and only the local actor's client swings (a remote guest swings in its own client). Verified in game in creative: selected and cycled `facing`, `half`, `shape`, `waterlogged` and others on stairs, slabs, fences, doors and candles; Shift reverses; the new state reaches the client. ## Vanilla reference `DebugStickItem` (`useOn`, `canDestroyBlock`, `handleInteraction`, `cycleState`, `getRelative`), `DebugStickState`, `Util.findNextInIterable` / `findPreviousInIterable`, the possible-value order of `BooleanProperty` / `EnumProperty`, `Player.isSecondaryUseActive` / `isShiftKeyDown`, `Player.canUseGameMasterBlocks` (`ServerPlayer.permissions`), and `ServerPlayerGameMode.useItemOn` (`ITEM_USED_ON_BLOCK`). Unit tests cover the state component and the wrapping order; no parity harness (the behaviour is a server block-state change plus a component). ## Self-check Not run locally; CI's verify and parity jobs cover the branch. --- <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:25 +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#5128
No description provided.