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

52 lines
2 KiB
Java
Raw Normal View History

2015-04-12 01:02:56 +02:00
package techreborn.api;
2015-04-12 21:04:12 +02:00
import techreborn.util.ItemUtils;
2015-04-15 17:23:12 +02:00
import java.util.ArrayList;
2015-04-12 01:02:56 +02:00
public final class TechRebornAPI {
2015-04-15 17:23:12 +02:00
public static ArrayList<CentrifugeRecipie> centrifugeRecipies = new ArrayList<CentrifugeRecipie>();
public static ArrayList<RollingMachineRecipie> rollingmachineRecipes = new ArrayList<RollingMachineRecipie>();
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);
}
public static void registerRollingMachineRecipe(RollingMachineRecipie recipie) {
boolean shouldAdd = true;
for (CentrifugeRecipie centrifugeRecipie : centrifugeRecipies) {
if (ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(), recipie.getInputItem1(), false, true)) {
try {
throw new RegisteredItemRecipe("Item " + recipie.getInputItem1().getUnlocalizedName() + " is already being used in a recipe for the RollingMachine");
} catch (RegisteredItemRecipe registeredItemRecipe) {
registeredItemRecipe.printStackTrace();
shouldAdd = false;
}
}
}
if (shouldAdd)
rollingmachineRecipes.add(recipie);
}
}
2015-04-14 01:12:24 +02:00
2015-04-15 17:23:12 +02:00
class RegisteredItemRecipe extends Exception {
public RegisteredItemRecipe(String message) {
super(message);
}
2015-04-12 01:02:56 +02:00
}