}
private void runShortcut(ShortcutConfig shortcut) throws TimeoutException {
// Try to put held item down
if (getHeldStack() != null) {
Slot slot = container.getSlotAtMousePosition();
if (slot != null) {
int slotNumber = getSlotNumber(slot);
container.putHoldItemDown(container.getSlotSection(slotNumber), container.getSlotIndex(slotNumber));
if (getHeldStack() != null) {
return;
}
}
else {
return;
}
}
synchronized(this) {
if (shortcut.type == InvTweaksShortcutType.MOVE_TO_SPECIFIC_HOTBAR_SLOT) {
container.move(shortcut.fromSection, shortcut.fromIndex, shortcut.toSection, shortcut.toIndex);
}
else {
int toIndex = getNextTargetIndex(shortcut);
boolean success;
int newIndex;
if (toIndex != -1) {
switch (shortcut.type) {
case MOVE_ONE_STACK:
{
Slot slot = container.getSlot(shortcut.fromSection, shortcut.fromIndex);
if (shortcut.fromSection != InvTweaksContainerSection.CRAFTING_OUT
&& shortcut.toSection != InvTweaksContainerSection.ENCHANTMENT) {
while (hasStack(slot) && toIndex != -1) {
success = container.move(shortcut.fromSection, shortcut.fromIndex, shortcut.toSection, toIndex);
newIndex = getNextTargetIndex(shortcut);