Added basic recipe remover for use in overriding Ic2 recipes.

This commit is contained in:
Gig 2015-04-11 00:29:11 +01:00
parent 0e2ad2637f
commit 6df95800e1
2 changed files with 59 additions and 9 deletions

View file

@ -13,15 +13,15 @@ import net.minecraft.util.IIcon;
public class ItemDusts extends Item public class ItemDusts extends Item
{ {
public static final String[] types = new String[] public static final String[] types = new String[]
{ {
"Almandine", "Aluminium", "Andradite", "Ashes", "Basalt", "Bauxite", "Brass", "Bronze", "Almandine", "Aluminium", "Andradite", "Ashes", "Basalt", "Bauxite", "Brass", "Bronze",
"Calcite","Charcoal", "Chrome", "Cinnabar", "Clay", "Coal", "Copper", "Dark Ashes", "Diamond", "Calcite","Charcoal", "Chrome", "Cinnabar", "Clay", "Coal", "Copper", "Dark Ashes", "Diamond",
"Electrum","Emerald", "Ender Eye", "Ender Pearl", "Endstone", "Flint", "Gold", "Green Sapphire", "Grossular", "Electrum","Emerald", "Ender Eye", "Ender Pearl", "Endstone", "Flint", "Gold", "Green Sapphire", "Grossular",
"Invar", "Iron", "Lazurite", "Lead", "Magnesium", "Marble", "Netherrack", "Nickel", "Obsidian", "Invar", "Iron", "Lazurite", "Lead", "Magnesium", "Marble", "Netherrack", "Nickel", "Obsidian",
"Olivine","Phosphor", "Platinum", "Pyrite", "Pyrope", "Red Garnet", "Redrock", "Ruby", "Saltpeter", "Sapphire", "Olivine","Phosphor", "Platinum", "Pyrite", "Pyrope", "Red Garnet", "Redrock", "Ruby", "Saltpeter", "Sapphire",
"Silver", "Sodalite", "Spessartine", "Sphalerite", "Steel", "Sulfur", "Tin", "Titanium", "Tungsten", "Uranium", "Silver", "Sodalite", "Spessartine", "Sphalerite", "Steel", "Sulfur", "Tin", "Titanium", "Tungsten", "Uranium",
"Uvarovite", "Yellow Garnet", "Zinc" "Uvarovite", "Yellow Garnet", "Zinc"
}; };
private IIcon[] textures; private IIcon[] textures;

View file

@ -0,0 +1,50 @@
package techreborn.util;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
public class RecipeRemover
{
public static void removeShapedRecipes(List<ItemStack> removelist)
{
for (ItemStack stack : removelist)
removeShapedRecipe(stack);
}
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);
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i--);
}
}
}
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);
if (tmpRecipe instanceof ShapedRecipes)
{
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
ItemStack recipeResult = recipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i++);
}
}
}
}
}