Class MKCSlotQuickMove

java.lang.Object
com.trevlar.menukit.core.MKCSlotQuickMove

public final class MKCSlotQuickMove extends Object
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 own moveItemStackTo (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 Type
    Method
    Description
    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 at index considering the slots on menu.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 at index considering the slots on menu. Returns the moved stack (vanilla's quickMoveStack contract: the original stack when something moved so the caller loops, ItemStack.EMPTY when 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.