2014-07-07 21:31:10 +02:00
package com.pahimar.ee3.recipe ;
2014-07-03 22:00:25 +02:00
2014-07-24 22:01:42 +02:00
import com.google.common.collect.ImmutableList ;
2015-05-07 19:45:06 +02:00
import com.pahimar.ee3.api.exchange.RecipeRegistryProxy ;
2014-07-07 21:31:10 +02:00
import com.pahimar.ee3.item.crafting.RecipeAludel ;
2015-05-07 21:11:23 +02:00
import com.pahimar.ee3.util.LoaderHelper ;
import com.pahimar.ee3.util.LogHelper ;
import cpw.mods.fml.common.Loader ;
2014-07-03 22:00:25 +02:00
import net.minecraft.item.ItemStack ;
import java.util.ArrayList ;
import java.util.List ;
2015-02-25 06:03:59 +01:00
public class AludelRecipeManager
2014-07-04 21:18:10 +02:00
{
2015-02-25 06:03:59 +01:00
private static AludelRecipeManager aludelRegistry = null ;
2014-07-03 22:00:25 +02:00
private List < RecipeAludel > aludelRecipes ;
2015-02-25 06:03:59 +01:00
private AludelRecipeManager ( )
2014-07-04 21:18:10 +02:00
{
2014-07-03 22:00:25 +02:00
aludelRecipes = new ArrayList < RecipeAludel > ( ) ;
}
2015-02-25 06:03:59 +01:00
public static AludelRecipeManager getInstance ( )
2014-07-04 21:18:10 +02:00
{
if ( aludelRegistry = = null )
{
2015-02-25 06:03:59 +01:00
aludelRegistry = new AludelRecipeManager ( ) ;
2014-07-03 22:00:25 +02:00
}
return aludelRegistry ;
}
2015-11-19 21:24:40 +01:00
public static void registerRecipes ( ) {
for ( RecipeAludel recipeAludel : AludelRecipeManager . getInstance ( ) . getRecipes ( ) ) {
RecipeRegistryProxy . addRecipe ( recipeAludel . getRecipeOutput ( ) , recipeAludel . getRecipeInputsAsWrappedStacks ( ) ) ;
}
}
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 ) )
{
2015-11-19 21:24:40 +01:00
LogHelper . trace ( RecipeRegistry . RECIPE_MARKER , " [{}] Mod with ID '%s' added Aludel recipe '%s' " , LoaderHelper . getLoaderState ( ) , Loader . instance ( ) . activeModContainer ( ) . getModId ( ) , recipeAludel ) ;
2014-07-03 22:00:25 +02:00
aludelRecipes . add ( recipeAludel ) ;
2014-07-04 21:18:10 +02:00
}
2014-07-03 22:00:25 +02:00
}
2014-07-04 21:18:10 +02:00
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-24 22:01:42 +02:00
return ImmutableList . copyOf ( aludelRecipes ) ;
}
2014-07-03 22:00:25 +02:00
}