Class MKCSlotQuickMove
java.lang.Object
com.trevlar.menukit.core.MKCSlotQuickMove
Library-owned shift-click (quick-move) routing for registered slots on a
foreign menu — a chest/furnace/donkey menu MenuKit didn't build, that a
slot has been projected onto (
MKCSlotProjection). The generalization of
MKCScreenHandler.quickMoveStack's declarative routing to a menu
whose own vanilla quickMoveStack knows nothing about the appended slot
tail block.
Why it's needed
Foreign menus compute their quick-move index ranges against the unprojected slot count, so appended slots sit outside every vanilla destination range: a shift-click into the menu never targets a slot, and a shift-click out of a slot hits vanilla code that has no case for the source index. This routes both directions through vanilla's ownmoveItemStackTo (the absorbed AbstractContainerMenuInvoker
invoker), so the merge/place math and the tail contract stay vanilla-exact — the
library moves the consumer's own slot, it invents no placement behavior.
§0019 — opt-in, consumer-triggered
The consumer keeps the one-line@Inject(HEAD, cancellable) on each
foreign menu's quickMoveStack and delegates here (MK/MKC never install
the interception). Whether a slot vacuums shift-clicks on a foreign
screen is opt-in per slot via QuickMoveParticipation.imports() +
SlotGroup#canAccept — a slot created with imports() == false
for its projected copy stays passive on chests. route(AbstractContainerMenu, Player, int) returns
ItemStack.EMPTY when no slot claims the move, which the consumer's HEAD
inject treats as "not handled — let vanilla run."-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.item.ItemStackroute(net.minecraft.world.inventory.AbstractContainerMenu menu, net.minecraft.world.entity.player.Player player, int index) Routes a shift-click atindexconsidering the slots onmenu.
-
Method Details
-
route
public static net.minecraft.world.item.ItemStack route(net.minecraft.world.inventory.AbstractContainerMenu menu, net.minecraft.world.entity.player.Player player, int index) Routes a shift-click atindexconsidering the slots onmenu. Returns the moved stack (vanilla'squickMoveStackcontract: the original stack when something moved so the caller loops,ItemStack.EMPTYwhen nothing moved). EMPTY also means "not a slot concern — let vanilla handle it"; the consumer's HEAD inject only cancels on a non-EMPTY return.
-