src/main/java/com/github/klikli_dev/occultism/crafting/recipe/SpiritTradeRecipe.java
/**
     * Consumes the given input and returns all unused items. isValid needs to be called first!
     *
     * @param input the input to consume.
     * @return the remaining items.
     */
Consumes the given input and returns all unused items. isValid needs to be called first.
@param input the input to consume.
@return the remaining items.
Consumes the given input and returns all unused items . isValid needs to be called first . @param input the input to consume . @return the remaining items .
public List<ItemStack> consume(List<ItemStack> input) {
        List<ItemStack> result = input.stream().map(ItemStack::copy).collect(Collectors.toList());
        for (Ingredient ingredient : this.getIngredients()) {
            for (Iterator<ItemStack> it = result.iterator(); it.hasNext(); ) {
                ItemStack stack = it.next();
                if (ingredient.test(stack)) {
                    stack.shrink(1);
                    if (stack.isEmpty())
                        it.remove();
                }
            }
        }
        return result;
    }
public List < ItemStack > consume ( List < ItemStack > input ) { List < ItemStack > result = input . stream ( ) . map ( ItemStack :: copy ) . collect ( Collectors . toList ( ) ) ; for ( Ingredient ingredient : this . getIngredients ( ) ) { for ( Iterator < ItemStack > it = result . iterator ( ) ; it . hasNext ( ) ; ) { ItemStack stack = it . next ( ) ; if ( ingredient . test ( stack ) ) { stack . shrink ( 1 ) ; if ( stack . isEmpty ( ) ) it . remove ( ) ; } } } return result ; }
Consumes the given input and returns all unused items.
Consumes the given input and returns all unused items .
//deep copy, otherwise stack.shrink will eat original input.