} else if(slotDef.isOutputSlot(slotIndex)) {
// merge result
if(!mergeItemStack(origStack, startPlayerSlot, endHotBarSlot, true)) {
return null;
}
slot.onSlotChange(origStack, copystack);
} else {
//Check from inv->input then inv->upgrade then inv->hotbar or hotbar->inv
if(slotIndex >= startPlayerSlot) {
if(slotDef.getNumInputSlots() <= 0 || !mergeItemStack(origStack, slotDef.getMinInputSlot(), slotDef.getMaxInputSlot() + 1, false)) {