diff --git a/src/main/java/techreborn/api/BlastFurnaceRecipe.java b/src/main/java/techreborn/api/BlastFurnaceRecipe.java new file mode 100644 index 000000000..c380d8f61 --- /dev/null +++ b/src/main/java/techreborn/api/BlastFurnaceRecipe.java @@ -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; + } +} + diff --git a/src/main/java/techreborn/api/TechRebornAPI.java b/src/main/java/techreborn/api/TechRebornAPI.java index 3c3526225..fc9685c65 100644 --- a/src/main/java/techreborn/api/TechRebornAPI.java +++ b/src/main/java/techreborn/api/TechRebornAPI.java @@ -8,7 +8,7 @@ import techreborn.util.ItemUtils; public final class TechRebornAPI { public static ArrayList centrifugeRecipies = new ArrayList(); - public static ArrayList rollingmachineRecipes = new ArrayList(); + public static ArrayList blastFurnaceRecipes = new ArrayList(); 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) {