if (mouseButton == 2) {
if (((IPhantomSlot) slot).canAdjust()) {
slot.putStack(null);
}
} else if (mouseButton == 0 || mouseButton == 1) {
InventoryPlayer playerInv = player.inventory;
slot.onSlotChanged();
ItemStack stackSlot = slot.getStack();
ItemStack stackHeld = playerInv.getItemStack();
if (stackSlot != null) {
stack = stackSlot.copy();
}
if (stackSlot == null) {
if (stackHeld != null && slot.isItemValid(stackHeld)) {
fillPhantomSlot(slot, stackHeld, mouseButton, modifier);
}
} else if (stackHeld == null) {
adjustPhantomSlot(slot, mouseButton, modifier);
slot.onPickupFromSlot(player, playerInv.getItemStack());
} else if (slot.isItemValid(stackHeld)) {
if (StackHelper.canStacksMerge(stackSlot, stackHeld)) {
adjustPhantomSlot(slot, mouseButton, modifier);
} else {
fillPhantomSlot(slot, stackHeld, mouseButton, modifier);