public ItemStack OfferItemStack(ItemStack i)
 {
     if (stack == null)
     {
         AssignItemStack(i);
         return(null);
     }
     else if (stack.Item == i.Item && stack.Item.Stackable)
     {
         stack.ChangeQuantity(i.Count);
         UpdateLabel();
         return(null);
     }
     else
     {
         return(i);
     }
 }
    public override void OnLeftPress()
    {
        ItemStack exchangeStack = exchangeSlot.GetCurItemStack();
        ItemStack slotStack     = GetCurItemStack();

        if (quickMoveItem != null && slotStack != null && Input.IsActionPressed("quick_move_items"))
        {
            if (quickMoveItem(slotStack))
            {
                ClearItemStack();
                invUpdate?.Invoke();
            }
            return;
        }

        if (exchangeStack != null &&
            !Item.CompatibleWith(exchangeStack.Item.IType, this.GetItemType()))
        {
            return;
        }

        if (slotStack != null &&
            !Item.CompatibleWith(slotStack.Item.IType, exchangeSlot.GetItemType()))
        {
            return;
        }

        // TODO: think of a better conditional
        if (exchangeStack != null && slotStack != null && slotStack.Item.Stackable && slotStack.Item.Id == exchangeStack.Item.Id)
        {
            slotStack.ChangeQuantity(exchangeStack.Count);
            exchangeSlot.ClearItemStack();
        }
        else
        {
            exchangeSlot.AssignItemStack(slotStack);
            this.AssignItemStack(exchangeStack);
        }
    }