Skip to content

Conversation

@doclic
Copy link

@doclic doclic commented Jul 25, 2024

Adds removeRecipe methods to org.bukkit.Bukkit, org.bukkit.Server, and org.bukkit.World.
This is mostly useful for removing Vanilla recipes like this:

for (Recipe recipe : Bukkit.getRecipesFor(new ItemStack(Material.STICK))) {
        Bukkit.removeRecipe(recipe);
}

@Pablete1234
Copy link
Contributor

You can accomplish the same effect via listener:

  @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
  public void removeDisabledRecipe(PrepareItemCraftEvent event) {
    CraftingInventory crafting = event.getInventory();
    ItemStack result = crafting.getResult();
    if (result == null) return;

    if (disabledRecipes.matches(result)) crafting.setResult(null);
  }

where disabledRecipes is your way of matching

@doclic
Copy link
Author

doclic commented Jul 25, 2024

You can accomplish the same effect via listener:

It felt like it would make sense for there to be a way to remove recipes if you can add some.
Since 1.15, Spigot has had a similar API that uses NamespacedKeys.

@Pablete1234
Copy link
Contributor

Modern versions have better ways of handling these, but if the api isn't going to be compatible anyways there's little point in adding a method in the older software, i don't think anyone will benefit from adding this except for the added maintenance burden to a version that is already struggling to get maintained.

Just do it via event, it works all the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants