2014-07-03 22:00:25 +02:00
|
|
|
package com.pahimar.ee3.recipe;
|
|
|
|
|
|
|
|
import com.pahimar.ee3.exchange.OreStack;
|
|
|
|
import com.pahimar.ee3.item.crafting.RecipeAludel;
|
|
|
|
import com.pahimar.ee3.util.LogHelper;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
public class RecipesAludel
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
private static RecipesAludel aludelRegistry = null;
|
|
|
|
|
|
|
|
private List<RecipeAludel> aludelRecipes;
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
private RecipesAludel()
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
aludelRecipes = new ArrayList<RecipeAludel>();
|
|
|
|
}
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
public static RecipesAludel getInstance()
|
|
|
|
{
|
|
|
|
if (aludelRegistry == null)
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
aludelRegistry = new RecipesAludel();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aludelRegistry;
|
|
|
|
}
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
public void addRecipe(ItemStack recipeOutput, ItemStack recipeInputStack, ItemStack recipeInputDust)
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
addRecipe(new RecipeAludel(recipeOutput, recipeInputStack, recipeInputDust));
|
|
|
|
}
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
public void addRecipe(RecipeAludel recipeAludel)
|
|
|
|
{
|
|
|
|
if (!aludelRecipes.contains(recipeAludel))
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
aludelRecipes.add(recipeAludel);
|
2014-07-04 21:18:10 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
LogHelper.debug(String.format("Attempted to add RecipeAludel '%s' but already exists in the recipe list", recipeAludel));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
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))
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
return recipeAludel.getRecipeOutput();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
public RecipeAludel getRecipe(ItemStack recipeInputStack, ItemStack recipeInputDust)
|
|
|
|
{
|
|
|
|
for (RecipeAludel recipeAludel : aludelRecipes)
|
|
|
|
{
|
|
|
|
if (recipeAludel.matches(recipeInputStack, recipeInputDust))
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
return recipeAludel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
public List<RecipeAludel> getRecipes()
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
return aludelRecipes;
|
|
|
|
}
|
|
|
|
|
2014-07-04 21:18:10 +02:00
|
|
|
public void debugDumpMap()
|
|
|
|
{
|
|
|
|
for (RecipeAludel recipeAludel : aludelRecipes)
|
|
|
|
{
|
2014-07-03 22:00:25 +02:00
|
|
|
LogHelper.debug(String.format("Output: %s, Input Stack: %s, Dust Stack: %s", recipeAludel.getRecipeOutput(), recipeAludel.getRecipeInputs()[0], recipeAludel.getRecipeInputs()[1]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|