package com.pahimar.ee3.recipe; import com.pahimar.ee3.exchange.OreStack; import com.pahimar.ee3.item.crafting.RecipeAludel; import net.minecraft.item.ItemStack; import java.util.ArrayList; import java.util.List; public class RecipesAludel { private static RecipesAludel aludelRegistry = null; private List aludelRecipes; private RecipesAludel() { aludelRecipes = new ArrayList(); } public static RecipesAludel getInstance() { if (aludelRegistry == null) { aludelRegistry = new RecipesAludel(); } return aludelRegistry; } public void addRecipe(ItemStack recipeOutput, ItemStack recipeInputStack, ItemStack recipeInputDust) { addRecipe(new RecipeAludel(recipeOutput, recipeInputStack, recipeInputDust)); } public void addRecipe(RecipeAludel recipeAludel) { if (!aludelRecipes.contains(recipeAludel)) { aludelRecipes.add(recipeAludel); } } public void addRecipe(ItemStack recipeOutput, OreStack recipeInputStack, ItemStack recipeInputDust) { addRecipe(new RecipeAludel(recipeOutput, recipeInputStack, recipeInputDust)); } public ItemStack getResult(ItemStack recipeInputStack, ItemStack recipeInputDust) { for (RecipeAludel recipeAludel : aludelRecipes) { if (recipeAludel.matches(recipeInputStack, recipeInputDust)) { return recipeAludel.getRecipeOutput(); } } return null; } public RecipeAludel getRecipe(ItemStack recipeInputStack, ItemStack recipeInputDust) { for (RecipeAludel recipeAludel : aludelRecipes) { if (recipeAludel.matches(recipeInputStack, recipeInputDust)) { return recipeAludel; } } return null; } public List getRecipes() { return aludelRecipes; } }