Small re-factor to the RecipeRemover
This commit is contained in:
parent
b9d880abe2
commit
9c94b045b3
2 changed files with 19 additions and 23 deletions
|
@ -76,7 +76,7 @@ public class ItemRockCutter extends ItemPickaxe implements IElectricItem {
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack){
|
public boolean canHarvestBlock(Block block, ItemStack stack){
|
||||||
return Items.diamond_pickaxe.canHarvestBlock(block, stack);
|
return Items.diamond_pickaxe.canHarvestBlock(block, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHarvestLevel(ItemStack stack, String toolClass)
|
public int getHarvestLevel(ItemStack stack, String toolClass)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,33 +17,29 @@ public class RecipeRemover {
|
||||||
public static void removeAnyRecipe(ItemStack resultItem)
|
public static void removeAnyRecipe(ItemStack resultItem)
|
||||||
{
|
{
|
||||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||||
for (int i = 0; i < recipes.size(); i++)
|
for(IRecipe tmpRecipe : recipes){
|
||||||
{
|
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
|
||||||
IRecipe tmpRecipe = recipes.get(i);
|
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||||
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
|
{
|
||||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
recipes.remove(tmpRecipe);
|
||||||
{
|
}
|
||||||
recipes.remove(i--);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeShapedRecipe(ItemStack resultItem)
|
public static void removeShapedRecipe(ItemStack resultItem)
|
||||||
{
|
{
|
||||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||||
for (int i = 0; i < recipes.size(); i++)
|
for (IRecipe tmpRecipe : recipes){
|
||||||
{
|
if (tmpRecipe instanceof ShapedRecipes)
|
||||||
IRecipe tmpRecipe = recipes.get(i);
|
{
|
||||||
if (tmpRecipe instanceof ShapedRecipes)
|
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
|
||||||
{
|
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||||
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
|
|
||||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
|
||||||
|
|
||||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||||
{
|
{
|
||||||
recipes.remove(i++);
|
recipes.remove(tmpRecipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue