Class ConservingGestureEngine
java.lang.Object
com.ultikits.ultitools.ui.container.ConservingGestureEngine
- All Implemented Interfaces:
GestureEngine
The only item-transfer path: decide in order, apply conserved deltas, then publish.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiConsumer<org.bukkit.entity.Player, Text> private final BooleanSupplierprivate final Predicate<SlotContainer> -
Constructor Summary
ConstructorsConstructorDescriptionConservingGestureEngine(BooleanSupplier onContainerThread, Predicate<SlotContainer> owns, BiConsumer<org.bukkit.entity.Player, Text> notifier) -
Method Summary
Modifier and TypeMethodDescriptionprivate intallowed(ConservingGestureEngine.Plan plan, SlotBinding binding, TransferKind kind, org.bukkit.inventory.ItemStack item, int requested) booleanapply(Grid grid, org.bukkit.entity.Player viewer, ViewerItems side, Gesture gesture) private static FrameworkSlotContainercontainer(SlotBinding binding) private @Nullable SlotBindingprivate voidexchange(ConservingGestureEngine.Plan plan, SlotBinding binding, org.bukkit.inventory.ItemStack source, int playerSlot) private voidhotbar(Grid grid, ConservingGestureEngine.Plan plan, Gesture.HotbarSwap gesture) private voidpickup(Grid grid, ConservingGestureEngine.Plan plan, Gesture.Pickup gesture) private voidplace(Grid grid, ConservingGestureEngine.Plan plan, Gesture.Place gesture) private intput(ConservingGestureEngine.Plan plan, SlotBinding binding, org.bukkit.inventory.ItemStack source, int requested, int playerSlot) private voidquickIn(Grid grid, ConservingGestureEngine.Plan plan, Gesture.QuickMoveIn gesture) private intquickInPass(ConservingGestureEngine.Plan plan, List<SlotBinding> targets, int sourceSlot, boolean empty, int remaining) private voidquickOut(Grid grid, ConservingGestureEngine.Plan plan, Gesture.QuickMoveOut gesture) private voidspread(Grid grid, ConservingGestureEngine.Plan plan, Gesture.Spread gesture) private voidswapCursor(Grid grid, ConservingGestureEngine.Plan plan, Gesture.SwapWithCursor gesture)
-
Field Details
-
onContainerThread
-
owns
-
notifier
-
-
Constructor Details
-
ConservingGestureEngine
ConservingGestureEngine(BooleanSupplier onContainerThread, Predicate<SlotContainer> owns, BiConsumer<org.bukkit.entity.Player, Text> notifier)
-
-
Method Details
-
apply
- Specified by:
applyin interfaceGestureEngine- Parameters:
grid- the snapshot the backend was last given (by open or update), notGridSession#current()- Returns:
- whether anything moved
-
editable
-
container
-
allowed
private int allowed(ConservingGestureEngine.Plan plan, SlotBinding binding, TransferKind kind, org.bukkit.inventory.ItemStack item, int requested) -
pickup
-
place
-
put
private int put(ConservingGestureEngine.Plan plan, SlotBinding binding, org.bukkit.inventory.ItemStack source, int requested, int playerSlot) -
swapCursor
private void swapCursor(Grid grid, ConservingGestureEngine.Plan plan, Gesture.SwapWithCursor gesture) -
hotbar
-
exchange
private void exchange(ConservingGestureEngine.Plan plan, SlotBinding binding, org.bukkit.inventory.ItemStack source, int playerSlot) -
quickOut
-
quickIn
-
quickInPass
private int quickInPass(ConservingGestureEngine.Plan plan, List<SlotBinding> targets, int sourceSlot, boolean empty, int remaining) -
spread
-