#529: Added getRecipe() method to retrieve a Recipe by it's NamespacedKey

By: jameslfc19 <jameslfc19@gmail.com>
This commit is contained in:
Bukkit/Spigot 2020-07-22 18:14:55 +10:00
parent 2d628bb34a
commit 2b0e21f46d
2 changed files with 20 additions and 0 deletions

View File

@ -716,6 +716,17 @@ public final class Bukkit {
return server.getRecipesFor(result);
}
/**
* Get the {@link Recipe} for the given key.
*
* @param recipeKey the key of the recipe to return
* @return the recipe for the given key or null.
*/
@Nullable
public static Recipe getRecipe(@NotNull NamespacedKey recipeKey) {
return server.getRecipe(recipeKey);
}
/**
* Get an iterator through the list of crafting recipes.
*

View File

@ -601,6 +601,15 @@ public interface Server extends PluginMessageRecipient {
@NotNull
public List<Recipe> getRecipesFor(@NotNull ItemStack result);
/**
* Get the {@link Recipe} for the given key.
*
* @param recipeKey the key of the recipe to return
* @return the recipe for the given key or null.
*/
@Nullable
public Recipe getRecipe(@NotNull NamespacedKey recipeKey);
/**
* Get an iterator through the list of crafting recipes.
*