TechReborn/src/main/java/techreborn/api/TechRebornAPI.java

81 lines
2.6 KiB
Java
Raw Normal View History

2015-04-12 01:02:56 +02:00
package techreborn.api;
2015-04-24 15:20:09 +02:00
import java.util.ArrayList;
2015-04-15 18:27:05 +02:00
import net.minecraft.item.ItemStack;
2015-04-12 21:04:12 +02:00
import techreborn.util.ItemUtils;
2015-04-12 01:02:56 +02:00
public final class TechRebornAPI {
2015-04-24 15:20:09 +02:00
public static ArrayList<CentrifugeRecipie> centrifugeRecipies = new ArrayList<CentrifugeRecipie>();
2015-04-26 18:13:28 +02:00
public static ArrayList<BlastFurnaceRecipe> blastFurnaceRecipes = new ArrayList<BlastFurnaceRecipe>();
2015-04-24 15:20:09 +02:00
public static void registerCentrifugeRecipe(CentrifugeRecipie recipie)
{
boolean shouldAdd = true;
for (CentrifugeRecipie centrifugeRecipie : centrifugeRecipies)
{
if (ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(),
recipie.getInputItem(), false, true))
{
try
{
throw new RegisteredItemRecipe(
"Item "
+ recipie.getInputItem()
.getUnlocalizedName()
+ " is already being used in a recipe for the Centrifuge");
} catch (RegisteredItemRecipe registeredItemRecipe)
{
registeredItemRecipe.printStackTrace();
shouldAdd = false;
}
}
}
if (shouldAdd)
centrifugeRecipies.add(recipie);
}
2015-04-26 18:13:28 +02:00
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);
}
2015-04-24 15:20:09 +02:00
public static void addRollingMachinceRecipe(ItemStack output,
Object... components)
{
RollingMachineRecipe.instance.addRecipe(output, components);
}
public void addShapelessRollingMachinceRecipe(ItemStack output,
Object... components)
{
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
}
2015-04-15 18:27:05 +02:00
}
2015-04-15 17:23:12 +02:00
class RegisteredItemRecipe extends Exception {
2015-04-24 15:20:09 +02:00
public RegisteredItemRecipe(String message)
{
super(message);
}
2015-04-12 01:02:56 +02:00
}