private void DefaultCase(UIItemSlot clickedSlot)
    {
        if (!cursorSlot.HasItem && clickedSlot.HasItem)
        {
            cursorSlot.PutStack(clickedSlot.TakeStack());
        }
        else
        {
            if (cursorSlot.HasItem && !clickedSlot.HasItem)
            {
                clickedSlot.PutStack(cursorSlot.TakeStack());
            }
            else if (cursorSlot.HasItem && clickedSlot.HasItem)
            {
                if (cursorSlot.ID != clickedSlot.ID)
                {
                    ItemStack oldCursorSlot = cursorSlot.TakeStack();
                    ItemStack oldSlot       = clickedSlot.TakeStack();

                    clickedSlot.PutStack(oldCursorSlot);
                    cursorSlot.PutStack(oldSlot);
                }
                else if (cursorSlot.Amount < cursorSlot.Size)
                {
                    int value = cursorSlot.Put(clickedSlot.Amount);

                    clickedSlot.Take(value);
                }
            }
        }
    }
Ejemplo n.º 2
0
    private void CheckForRecipe()
    {
        foreach (var recipe in recipesBook.Recipes)
        {
            if (CompareRecipe(recipe))
            {
                result.PutStack(new ItemStack(recipe.Result, recipe.ResultAmount, 64));

                return;
            }
        }

        result.Clear();
    }