Fixed the second output not being checked when registering oredict crusher recipes

This commit is contained in:
Ellpeck 2015-08-31 13:59:59 +02:00
parent 5b812a6b67
commit ed842e6fe4

View file

@ -23,7 +23,7 @@ public class CrusherRecipeManualRegistry{
public static ArrayList<CrusherRecipe> recipes = new ArrayList<CrusherRecipe>();
public static void registerRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int secondChance){
if(!hasRecipe(input, outputOne)){
if(!hasRecipe(input, outputOne, outputTwo)){
recipes.add(new CrusherRecipe(input, outputOne, outputTwo, secondChance));
}
}
@ -51,20 +51,24 @@ public class CrusherRecipeManualRegistry{
registerRecipe(theInput, theOutputOne, theOutputTwo, secondChance);
}
}
else registerRecipe(theInput, theOutputOne, null, 0);
}
}
else{
if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled())
ModUtil.LOGGER.warn("Couldn't register Crusher Recipe! An Item with OreDictionary Registry '" + outputOne + "' doesn't exist! It should be the output of '" + input + "'!");
registerRecipe(theInput, theOutputOne, null, 0);
}
}
}
else{
if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled())
if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled()){
ModUtil.LOGGER.warn("Couldn't register Crusher Recipe! An Item with OreDictionary Registry '"+outputOne+"' doesn't exist! It should be the output of '"+input+"'!");
}
}
}
}
else{
if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled()){
ModUtil.LOGGER.warn("Couldn't register Crusher Recipe! Didn't find Items registered as '"+input+"'!");
}
}
}
public static void registerRecipe(ItemStack input, ItemStack outputOne){
registerRecipe(input, outputOne, null, 0);
@ -79,9 +83,13 @@ public class CrusherRecipeManualRegistry{
return null;
}
public static boolean hasRecipe(ItemStack input, ItemStack outputOne){
public static boolean hasRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo){
for(CrusherRecipe recipe : recipes){
if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne) || (recipe.input.getItem() == input.getItem() && recipe.firstOutput.getItem() == outputOne.getItem() && recipe.input.getItemDamage() == Util.WILDCARD)) return true;
if(outputTwo == null || (recipe.secondOutput != null && recipe.secondOutput.isItemEqual(outputTwo))){
if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne) || (recipe.input.getItem() == input.getItem() && recipe.firstOutput.getItem() == outputOne.getItem() && recipe.input.getItemDamage() == Util.WILDCARD)){
return true;
}
}
}
return false;
}