Merge branch 'master' of https://bitbucket.org/calclavia/resonant-induction
This commit is contained in:
commit
da01b0f37e
1 changed files with 23 additions and 9 deletions
|
@ -4,7 +4,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import resonantinduction.api.RecipeUtils.Resource;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import resonantinduction.api.RecipeUtils.*;
|
||||
|
||||
public final class MachineRecipes
|
||||
{
|
||||
|
@ -19,7 +21,7 @@ public final class MachineRecipes
|
|||
METAL_FORMER;
|
||||
}
|
||||
|
||||
private final Map<RecipeType, Map<List<Resource>, List<Resource>>> recipes = new HashMap<RecipeType, Map<List<Resource>, List<Resource>>>();
|
||||
private final Map<RecipeType, Map<Resource[], Resource[]>> recipes = new HashMap<RecipeType, Map<Resource[], Resource[]>>();
|
||||
|
||||
public static final MachineRecipes INSTANCE = new MachineRecipes();
|
||||
|
||||
|
@ -27,28 +29,40 @@ public final class MachineRecipes
|
|||
{
|
||||
for (RecipeType machine : RecipeType.values())
|
||||
{
|
||||
this.recipes.put(machine, new HashMap<List<Resource>, List<Resource>>());
|
||||
this.recipes.put(machine, new HashMap<Resource[], Resource[]>());
|
||||
}
|
||||
}
|
||||
|
||||
public void addRecipe(RecipeType machine, List<Resource> input, List<Resource> output)
|
||||
public void addRecipe(RecipeType machine, Resource[] input, Resource[] output)
|
||||
{
|
||||
this.recipes.get(machine).put(input, output);
|
||||
}
|
||||
|
||||
public void removeRecipe(RecipeType machine, List<Resource> input)
|
||||
public void removeRecipe(RecipeType machine, Resource[] input)
|
||||
{
|
||||
this.recipes.get(machine).remove(input);
|
||||
}
|
||||
|
||||
public Map<List<Resource>, List<Resource>> getRecipes(RecipeType machine)
|
||||
public Map<Resource[], Resource[]>getRecipes(RecipeType machine)
|
||||
{
|
||||
return new HashMap<List<Resource>, List<Resource>>(this.recipes.get(machine));
|
||||
return new HashMap<Resource[], Resource[]>(this.recipes.get(machine));
|
||||
}
|
||||
|
||||
public Map<RecipeType, Map<List<Resource>, List<Resource>>> getRecipes()
|
||||
public Map<RecipeType, Map<Resource[], Resource[]>> getRecipes()
|
||||
{
|
||||
return new HashMap<RecipeType, Map<List<Resource>, List<Resource>>>(this.recipes);
|
||||
return new HashMap<RecipeType, Map<Resource[], Resource[]>>(this.recipes);
|
||||
}
|
||||
|
||||
public Resource[] getRecipe(RecipeType machine, ItemStack primary, ItemStack... secondary)
|
||||
{
|
||||
Resource[] input = new Resource[secondary.length +1];
|
||||
input[0] = new ItemStackResource(primary);
|
||||
for (int i = 0; i < secondary.length; i++)
|
||||
{
|
||||
input[i+1] = new ItemStackResource(secondary[i]);
|
||||
}
|
||||
|
||||
return this.getRecipes(machine).get(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue