I'm trying to change the recipe for wooden planks in 1.12.2. Whenever I need to change the recipe for something, I remove the vanilla one and then add my own JSON file in assets. However, I'm having trouble removing the recipe for things with metadata. How do I remove the recipes for wood planks, for example? Here's the code I've been using:
I am unable to use replaceTheseRecipes.add(minecraft:oak_planks), and replaceTheseRecipes.add(minecraft:planks) doesn't work either. Any help is appreciated!
public static void removeRecipes() {
ForgeRegistry<IRecipe> recipeRegistry = (ForgeRegistry<IRecipe>)ForgeRegistries.RECIPES;
ArrayList<IRecipe> recipes = Lists.newArrayList(recipeRegistry.getValuesCollection());
ArrayList<String> replaceTheseRecipes = Lists.newArrayList();
replaceTheseRecipes.add("minecraft:stone_sword");
replaceTheseRecipes.add("minecraft:stone_pickaxe");
replaceTheseRecipes.add("minecraft:stone_axe");
replaceTheseRecipes.add("minecraft:stone_shovel");
replaceTheseRecipes.add("minecraft:stone_hoe");
replaceTheseRecipes.add("minecraft:furnace");
replaceTheseRecipes.add("minecraft:chest");
replaceTheseRecipes.add("minecraft:stick");
for (IRecipe r : recipes)
{
ItemStack output = r.getRecipeOutput();
for (String replaceThisItem : replaceTheseRecipes) {
Item itemToReplace = Item.getByNameOrId(replaceThisItem);
if (output.getItem() == itemToReplace)
{
System.out.println("The r.getRegistry name is: " + r.getRegistryName() + ". The Item.getRegistryName was: " + itemToReplace.getRegistryName());
if (r.getRegistryName().equals(itemToReplace.getRegistryName()))
{
System.out.println("We're now removing the recipe for: " + r.getRegistryName());
recipeRegistry.remove(r.getRegistryName());
break;
} else
{
System.out.println("We DIDN'T remove a suspiciously similar item: " + r.getRegistryName());
}
}
}
}
}