Hello, Yesterday, as I was working on the Custom Recipes of my Custom Items I came across the following issue. I have replicated it here with some simpler code. Let's say that I want to override the Wooden Axe recipe to give TNT. My code would look like this: Code (Text): @SuppressWarnings("deprecation") public void onEnable() { ShapedRecipe recipe = new ShapedRecipe(new ItemStack(Material.TNT)); recipe.shape("110", "120", "020"); recipe.setIngredient('1', Material.WOOD, 1); recipe.setIngredient('2', Material.STICK); Bukkit.addRecipe(recipe); } And that works just fine, as you can see in the attached screenshot. However, let's say I wanted to override the Pickaxe Recipe instead. My code would look like this: Code (Text): @SuppressWarnings("deprecation") public void onEnable() { ShapedRecipe recipe = new ShapedRecipe(new ItemStack(Material.TNT)); recipe.shape("111", "020", "020"); recipe.setIngredient('1', Material.WOOD, 1); recipe.setIngredient('2', Material.STICK); Bukkit.addRecipe(recipe); } However, that doesn't work, as you can see in the attached screenshot. That's all the code that was running on the server at the time. I am running this on a 1.11.2 local Spigot Server. I also tried not using Magic values and instead having just the Planks, which didn't work either. I know that an easy solution to this would be to just make a PrepareItemCraftEvent listener and manually detect and override that. However, that's not a universal solution, as if I or someone else were to add a different recipe, the result wouldn't be the same. So, do I report this on the bug tracker? Am I doing something wrong? Has anyone else had this issue before? And do you have any ideas on how I could make a universal solution? Thanks in advance.
How about completely removing the recipe for a wooden pickaxe? You can go through the recipe iterator and remove recipes resulting in a wooden pickaxe. Then add your own recipe.
IT WORKS! Thank you so much! This is perfect, I'm going to adjust the code so that it fits my API. THANK YOU! Final code: Code (Text): Iterator<Recipe> recipes = Bukkit.recipeIterator(); while (recipes.hasNext()) { if (recipes.next().getResult().getType().equals(Material.WOOD_PICKAXE)) { recipes.remove(); } } ShapedRecipe recipe = new ShapedRecipe(new ItemStack(Material.TNT)); recipe.shape("111", "020", "020"); recipe.setIngredient('1', Material.WOOD, 1); recipe.setIngredient('2', Material.STICK); Bukkit.addRecipe(recipe);