[GH-ISSUE #6562] Native hook for quick move (shift-click) in a mod container's menu #2134

Closed
opened 2026-11-02 15:52:23 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @JuanLuci on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6562

Originally assigned to: @levzzz5154 on GitHub.

Summary

A server hook that lets a mod decide what a shift-click does in its mod container's menu, the way a Java menu overrides AbstractContainerMenu.quickMoveStack.

Why

Since #5866 a mod menu type's clicks run on the vanilla menu engine: quick_move in menu.rs moves a stack between the menu's slots and the player's, in a fixed order. native_menu_slot_rules (API 130) can refuse a slot or change how much it holds, but it can't choose where a stack goes. That leaves out:

  • Storage whose items aren't in the menu's slots: a storage terminal's network, a drawer, a mod that stores items as data. A shift-click from the inventory has nowhere to go.
  • Machines with routing rules: fuel to the fuel slot and ores to the input, whichever comes first in the slot order.
  • Menus on a vanilla menu type whose screen hides the container's slots (None in NativeScreen.slots): in my test the press does nothing, with no feedback to the player, and the mod hears nothing of it.

#5524 lists quick-move rules among what mod menu types need. Its open part, as #4953 tracks it, is opening a menu with extra data, so I'm filing this on its own. It's fine to fold it in there if you prefer.

Proposal

  • native_menu_quick_move(pos, entity, slot, stack, handled), called on the server before the vanilla routing, for mod containers on vanilla menu types and on mod menu types.
  • slot is the clicked slot's index in the menu and stack the stack in it. The mod takes what it moves out of stack, for example with native_insert_item, and sets handled to skip the vanilla routing. Unhandled, nothing changes.
  • The player is named as in other hooks (see the related bug on native_menu_button_v2, #6557).

On my port

The Storage Terminal of Tom's Simple Storage (tom5454, MIT) shows the contents of every connected inventory in one list, and in Java a shift-click from the player's inventory puts the stack into the network. My port uses minecraft:generic_9x1 with its slots hidden, because the items live in the connected inventories and not in the menu.

Tested on Nightly c9d474d with the port, and again on main at f8bfa06b9 with a minimal bundle: a shift-click on an inventory slot leaves the stack exactly where it was. On main I also did it with the mouse, on the port, holding shift with horizon-ctl key and using click-at: the stack stays in the slot and nothing reaches the block entity. The same click without shift picks it up, so the click lands on the slot.

There is no workaround from a mod: to store something, the player picks it up and clicks the list. Shift-click in the other direction, out of the list, works, because the list is the mod's own drawing and it gets that click.

Originally created by @JuanLuci on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6562 Originally assigned to: @levzzz5154 on GitHub. ## Summary A server hook that lets a mod decide what a shift-click does in its mod container's menu, the way a Java menu overrides `AbstractContainerMenu.quickMoveStack`. ## Why Since #5866 a mod menu type's clicks run on the vanilla menu engine: `quick_move` in `menu.rs` moves a stack between the menu's slots and the player's, in a fixed order. `native_menu_slot_rules` (API 130) can refuse a slot or change how much it holds, but it can't choose where a stack goes. That leaves out: - Storage whose items aren't in the menu's slots: a storage terminal's network, a drawer, a mod that stores items as data. A shift-click from the inventory has nowhere to go. - Machines with routing rules: fuel to the fuel slot and ores to the input, whichever comes first in the slot order. - Menus on a vanilla menu type whose screen hides the container's slots (`None` in `NativeScreen.slots`): in my test the press does nothing, with no feedback to the player, and the mod hears nothing of it. #5524 lists quick-move rules among what mod menu types need. Its open part, as #4953 tracks it, is opening a menu with extra data, so I'm filing this on its own. It's fine to fold it in there if you prefer. ## Proposal - `native_menu_quick_move(pos, entity, slot, stack, handled)`, called on the server before the vanilla routing, for mod containers on vanilla menu types and on mod menu types. - `slot` is the clicked slot's index in the menu and `stack` the stack in it. The mod takes what it moves out of `stack`, for example with `native_insert_item`, and sets `handled` to skip the vanilla routing. Unhandled, nothing changes. - The player is named as in other hooks (see the related bug on `native_menu_button_v2`, #6557). ## On my port The Storage Terminal of Tom's Simple Storage (tom5454, MIT) shows the contents of every connected inventory in one list, and in Java a shift-click from the player's inventory puts the stack into the network. My port uses `minecraft:generic_9x1` with its slots hidden, because the items live in the connected inventories and not in the menu. Tested on Nightly c9d474d with the port, and again on main at f8bfa06b9 with a minimal bundle: a shift-click on an inventory slot leaves the stack exactly where it was. On main I also did it with the mouse, on the port, holding shift with `horizon-ctl key` and using `click-at`: the stack stays in the slot and nothing reaches the block entity. The same click without shift picks it up, so the click lands on the slot. There is no workaround from a mod: to store something, the player picks it up and clicks the list. Shift-click in the other direction, out of the list, works, because the list is the mod's own drawing and it gets that click.
Author
Owner

@levzzz5154 commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6571620906 --> @levzzz5154 commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
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#2134
No description provided.