Added BlastFurnaceRecipe

This commit is contained in:
modmuss50 2015-04-26 17:13:28 +01:00
parent db62b7a8b8
commit 3c48ea35a7
2 changed files with 81 additions and 1 deletions

View file

@ -0,0 +1,58 @@
package techreborn.api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class BlastFurnaceRecipe {
ItemStack input1, input2;
ItemStack output1, output2;
int tickTime;
int minHeat;
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2,int tickTime, int minHeat) {
this.input1 = input1;
this.input2 = input2;
this.output1 = output1;
this.output2 = output2;
this.tickTime = tickTime;
this.minHeat = minHeat;
}
public BlastFurnaceRecipe(Item input1, Item input2, int inputAmount, Item output1, net.minecraft.item.Item output2, int tickTime, int minHeat) {
if(input1 != null)
this.input1 = new ItemStack(input1, inputAmount);
if(input2 != null)
this.input2 = new ItemStack(input1, inputAmount);
if (output1 != null)
this.output1 = new ItemStack(output1);
if (output2 != null)
this.output2 = new ItemStack(output2);
this.tickTime = tickTime;
this.minHeat = minHeat;
}
public ItemStack getInput1() {
return input1;
}
public ItemStack getInput2() {
return input2;
}
public ItemStack getOutput1() {
return output1;
}
public ItemStack getOutput2() {
return output2;
}
public int getTickTime() {
return tickTime;
}
public int getMinHeat() {
return minHeat;
}
}

View file

@ -8,7 +8,7 @@ import techreborn.util.ItemUtils;
public final class TechRebornAPI {
public static ArrayList<CentrifugeRecipie> centrifugeRecipies = new ArrayList<CentrifugeRecipie>();
public static ArrayList<RollingMachineRecipe> rollingmachineRecipes = new ArrayList<RollingMachineRecipe>();
public static ArrayList<BlastFurnaceRecipe> blastFurnaceRecipes = new ArrayList<BlastFurnaceRecipe>();
public static void registerCentrifugeRecipe(CentrifugeRecipie recipie)
{
@ -36,6 +36,28 @@ public final class TechRebornAPI {
centrifugeRecipies.add(recipie);
}
public static void registerBlastFurnaceRecipe(BlastFurnaceRecipe recipie) {
boolean shouldAdd = true;
for (BlastFurnaceRecipe blastFurnaceRecipe : blastFurnaceRecipes) {
if (ItemUtils.isItemEqual(blastFurnaceRecipe.getInput1(), recipie.getInput1(), false, true) && ItemUtils.isItemEqual(blastFurnaceRecipe.getInput2(), recipie.getInput2(), false, true)) {
{
try {
throw new RegisteredItemRecipe(
"Item "
+ recipie.getInput1()
.getUnlocalizedName()
+ " and " + recipie.getInput2().getUnlocalizedName() + " is already being used in a recipe for the BlastFurnace");
} catch (RegisteredItemRecipe registeredItemRecipe) {
registeredItemRecipe.printStackTrace();
shouldAdd = false;
}
}
}
}
if (shouldAdd)
blastFurnaceRecipes.add(recipie);
}
public static void addRollingMachinceRecipe(ItemStack output,
Object... components)
{