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

This commit is contained in:
jameslfc19 2020-07-22 18:14:55 +10:00 committed by md_5
parent aff39bc0dc
commit ef0999fee4
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11
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.
*