Some unfished work on doing the ore dic recipes in a better way
This commit is contained in:
parent
48280690f5
commit
333ba855fe
2 changed files with 69 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -41,4 +44,69 @@ public class RecipeHanderer {
|
|||
}
|
||||
|
||||
|
||||
public static void addOreDicRecipes(){
|
||||
ArrayList<IBaseRecipeType> newRecipes = new ArrayList<IBaseRecipeType>();
|
||||
for(IBaseRecipeType baseRecipe : recipeList){
|
||||
if(baseRecipe instanceof BaseRecipe){
|
||||
int i = 0;
|
||||
for(ItemStack stack : baseRecipe.getInputs()){
|
||||
for(int oreId : OreDictionary.getOreIDs(stack)){
|
||||
for(ItemStack itemStack : OreDictionary.getOres(oreId)){
|
||||
OreDicRecipe recipe = new OreDicRecipe(baseRecipe.getRecipeName(), ((BaseRecipe) baseRecipe).tickTime, ((BaseRecipe) baseRecipe).tickTime);
|
||||
recipe.inputs.add(itemStack);
|
||||
newRecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class OreDicRecipe implements IBaseRecipeType{
|
||||
|
||||
public ArrayList<ItemStack> inputs;
|
||||
|
||||
public ArrayList<ItemStack> outputs;
|
||||
|
||||
public String name;
|
||||
|
||||
public int tickTime;
|
||||
|
||||
public int euPerTick;
|
||||
|
||||
public OreDicRecipe(String name, int tickTime, int euPerTick) {
|
||||
inputs = new ArrayList<ItemStack>();
|
||||
outputs = new ArrayList<ItemStack>();
|
||||
this.name = name;
|
||||
//This adds all new recipes
|
||||
this.tickTime = tickTime;
|
||||
this.euPerTick = euPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int euPerTick() {
|
||||
return euPerTick;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import codechicken.nei.PositionedStack;
|
|||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import techreborn.api.recipe.IBaseRecipeType;
|
||||
import techreborn.api.recipe.RecipeHanderer;
|
||||
|
|
Loading…
Add table
Reference in a new issue