@@ -0,0 +1,3341 @@
+package org.cyclops.cyclopscore.recipe.custom;%0A%0Aimport com.google.common.base.Function;%0Aimport com.google.common.collect.Lists;%0Aimport org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition;%0Aimport org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeHandler;%0Aimport org.cyclops.commoncapabilities.api.capability.recipehandler.RecipeDefinition;%0Aimport org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients;%0Aimport org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;%0Aimport org.cyclops.cyclopscore.ingredient.recipe.IngredientRecipeHelpers;%0Aimport org.cyclops.cyclopscore.recipe.custom.api.IMachine;%0Aimport org.cyclops.cyclopscore.recipe.custom.api.IRecipe;%0Aimport org.cyclops.cyclopscore.recipe.custom.api.IRecipeInput;%0Aimport org.cyclops.cyclopscore.recipe.custom.api.IRecipeOutput;%0Aimport org.cyclops.cyclopscore.recipe.custom.api.IRecipeProperties;%0A%0Aimport javax.annotation.Nullable;%0Aimport java.util.Collection;%0Aimport java.util.Set;%0A%0A/**%0A * An adapter class for exposing an %7B@link IMachine%7D as an %7B@link IRecipeHandler%7D.%0A * @param %3CM%3E The type of the machine.%0A * @param %3CI%3E The type of the recipe input of all recipes associated with the machine.%0A * @param %3CO%3E The type of the recipe output of all recipes associated with the machine.%0A * @param %3CP%3E The type of the recipe properties of all recipes associated with the machine.%0A */%0Apublic abstract class RecipeHandlerMachine%3CM extends IMachine%3CM, I, O, P%3E,%0A        I extends IRecipeInput, O extends IRecipeOutput, P extends IRecipeProperties%3E implements IRecipeHandler %7B%0A%0A    private final M machine;%0A    private final Set%3CIngredientComponent%3C?, ?%3E%3E recipeInputComponents;%0A    private final Set%3CIngredientComponent%3C?, ?%3E%3E recipeOutputComponents;%0A%0A    public RecipeHandlerMachine(M machine,%0A                                Set%3CIngredientComponent%3C?, ?%3E%3E recipeInputComponents,%0A                                Set%3CIngredientComponent%3C?, ?%3E%3E recipeOutputComponents) %7B%0A        this.machine = machine;%0A        this.recipeInputComponents = recipeInputComponents;%0A        this.recipeOutputComponents = recipeOutputComponents;%0A    %7D%0A%0A    @Override%0A    public Set%3CIngredientComponent%3C?, ?%3E%3E getRecipeInputComponents() %7B%0A        return recipeInputComponents;%0A    %7D%0A%0A    @Override%0A    public Set%3CIngredientComponent%3C?, ?%3E%3E getRecipeOutputComponents() %7B%0A        return recipeOutputComponents;%0A    %7D%0A%0A    @Override%0A    public Collection%3CIRecipeDefinition%3E getRecipes() %7B%0A        return Lists.transform(machine.getRecipeRegistry().allRecipes(), getRecipeTransformer());%0A    %7D%0A%0A    @Nullable%0A    @Override%0A    public IMixedIngredients simulate(IMixedIngredients input) %7B%0A        IRecipe%3CI, O, P%3E recipe = machine.getRecipeRegistry().findRecipeByInput(inputIngredientsToRecipeInput(input));%0A        if (recipe == null) %7B%0A            return null;%0A        %7D%0A        return getRecipeTransformer().apply(recipe).getOutput();%0A    %7D%0A%0A    protected Function%3CIRecipe%3CI, O, P%3E, IRecipeDefinition%3E getRecipeTransformer() %7B%0A        return recipe -%3E new RecipeDefinition(%0A                IngredientRecipeHelpers.toRecipeDefinitionInput(recipe.getInput()),%0A                IngredientRecipeHelpers.toRecipeDefinitionOutput(recipe.getOutput())%0A        );%0A    %7D%0A%0A    protected abstract I inputIngredientsToRecipeInput(IMixedIngredients inputIngredients);%0A%7D%0A

Add RecipeHandlerMachine adapter