[GH-ISSUE #3313] Pick Block does not select the matching hotbar slot #931

Closed
opened 2026-11-02 15:42:57 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @BAHE4KA-work on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3313

Steps to reproduce

  1. In Creative mode, aim at a block and press the middle mouse button (Pick Block), with the block absent from the hotbar.
  2. Repeat while the same block is already in the hotbar.
  3. In Survival mode, have the matching block in the hotbar, aim at it and press the middle mouse button.

Expected behavior

As in vanilla Minecraft, Pick Block selects the matching hotbar slot. In Creative mode, a block added to the hotbar should also be selected automatically.

Actual behavior

In Creative mode, the targeted block is added to the hotbar but is not selected. If it is already in the hotbar, its slot is also not selected. In Survival mode, the matching hotbar slot is not selected either.

Environment

  • Windows
  • Horizon build: nightly-2026-10-28-9b772b2
  • Game modes: Creative and Survival
Originally created by @BAHE4KA-work on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3313 ## Steps to reproduce 1. In Creative mode, aim at a block and press the middle mouse button (Pick Block), with the block absent from the hotbar. 2. Repeat while the same block is already in the hotbar. 3. In Survival mode, have the matching block in the hotbar, aim at it and press the middle mouse button. ## Expected behavior As in vanilla Minecraft, Pick Block selects the matching hotbar slot. In Creative mode, a block added to the hotbar should also be selected automatically. ## Actual behavior In Creative mode, the targeted block is added to the hotbar but is not selected. If it is already in the hotbar, its slot is also not selected. In Survival mode, the matching hotbar slot is not selected either. ## Environment - Windows - Horizon build: nightly-2026-10-28-9b772b2 - Game modes: Creative and Survival
Author
Owner

@d3grando commented on GitHub (Oct 29, 2026):

🤖 Agent: triage by d3grando's AI agent (Claude Code), not by d3grando themselves.

Reproduced on Windows 11 (v0.2.97 and main 142388e1c), in creative and survival single player: Pick Block finds the item but the old hotbar slot stays selected. The cause is leave_guest in game/lan_actions.rs, which throws away the slot pick_item::pick chose, so the server sends SetHeldSlot with the old one. Vanilla's tryPickItem → setSelectedSlot sends the new slot.

The open PR #3148 ("Select the picked hotbar slot in singleplayer and LAN", fixes #3031) makes exactly that change, so this looks like a duplicate of #3031. #3383 (spawn egg with an occupied slot) is the same cause.

<!-- gh-comment-id:6484074155 --> @d3grando commented on GitHub (Oct 29, 2026): 🤖 Agent: triage by d3grando's AI agent (Claude Code), not by d3grando themselves. Reproduced on Windows 11 (v0.2.97 and main 142388e1c), in creative and survival single player: Pick Block finds the item but the old hotbar slot stays selected. The cause is `leave_guest` in `game/lan_actions.rs`, which throws away the slot `pick_item::pick` chose, so the server sends `SetHeldSlot` with the old one. Vanilla's `tryPickItem` → `setSelectedSlot` sends the new slot. The open PR #3148 ("Select the picked hotbar slot in singleplayer and LAN", fixes #3031) makes exactly that change, so this looks like a duplicate of #3031. #3383 (spawn egg with an occupied slot) is the same cause.
Author
Owner

@levzzz5154 commented on GitHub (Oct 29, 2026):

🤖 Agent: (written by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves.)

Fixed by #3148 (merged 2026-10-29, commit 0543cf034, "Select the picked hotbar slot in singleplayer and LAN"). As the triage above found, leave_guest in game/lan_actions.rs threw away the slot that pick_item::pick chose, so the server sent SetHeldSlot with the old slot. Main now keeps the guest's new selection (g.selected = std::mem::replace(&mut self.selected, selected), lan_actions.rs:680). That covers all three cases in the report (creative with the block absent, creative with it already in the hotbar, survival), because they all go through that restore. Your build (nightly 9b772b2) predates it. Please reopen if a newer Nightly still doesn't select the slot.

<!-- gh-comment-id:6504522592 --> @levzzz5154 commented on GitHub (Oct 29, 2026): 🤖 Agent: (written by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves.) Fixed by #3148 (merged 2026-10-29, commit 0543cf034, "Select the picked hotbar slot in singleplayer and LAN"). As the triage above found, `leave_guest` in `game/lan_actions.rs` threw away the slot that `pick_item::pick` chose, so the server sent `SetHeldSlot` with the old slot. Main now keeps the guest's new selection (`g.selected = std::mem::replace(&mut self.selected, selected)`, lan_actions.rs:680). That covers all three cases in the report (creative with the block absent, creative with it already in the hotbar, survival), because they all go through that restore. Your build (nightly 9b772b2) predates it. Please reopen if a newer Nightly still doesn't select the slot.
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#931
No description provided.