Small re-factor to the RecipeRemover

This commit is contained in:
modmuss50 2015-07-27 19:40:00 +01:00
parent b9d880abe2
commit 9c94b045b3
2 changed files with 19 additions and 23 deletions

View file

@ -17,13 +17,11 @@ public class RecipeRemover {
public static void removeAnyRecipe(ItemStack resultItem)
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
{
IRecipe tmpRecipe = recipes.get(i);
for(IRecipe tmpRecipe : recipes){
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i--);
recipes.remove(tmpRecipe);
}
}
}
@ -31,9 +29,7 @@ public class RecipeRemover {
public static void removeShapedRecipe(ItemStack resultItem)
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
{
IRecipe tmpRecipe = recipes.get(i);
for (IRecipe tmpRecipe : recipes){
if (tmpRecipe instanceof ShapedRecipes)
{
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
@ -41,7 +37,7 @@ public class RecipeRemover {
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i++);
recipes.remove(tmpRecipe);
}
}
}