From 70fb3b5056e837b48f2957e4c5bbceb80a4eff39 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 22 Jul 2020 18:14:58 +1000 Subject: [PATCH] #714: Added getRecipe() method to retrieve a Recipe by it's NamespacedKey By: jameslfc19 --- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 20a44e008e..0f0e381207 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1208,6 +1208,13 @@ public final class CraftServer implements Server { return results; } + @Override + public Recipe getRecipe(NamespacedKey recipeKey) { + Preconditions.checkArgument(recipeKey != null, "recipeKey == null"); + + return getServer().getCraftingManager().a(CraftNamespacedKey.toMinecraft(recipeKey)).map(IRecipe::toBukkitRecipe).orElse(null); + } + @Override public Iterator recipeIterator() { return new RecipeIterator();