From dc69d2b3db466073cff0243bb8c342715dc88e2e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 1 Sep 2018 14:12:20 +1000 Subject: [PATCH] Fix unbound shaped recipe ingredients --- .../java/org/bukkit/craftbukkit/inventory/CraftRecipe.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java index eec606b226..3a704d1070 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.inventory; +import net.minecraft.server.RecipeItemStack; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import org.bukkit.inventory.RecipeChoice; @@ -9,8 +10,10 @@ public interface CraftRecipe extends Recipe { void addToCraftingManager(); default net.minecraft.server.RecipeItemStack toNMS(RecipeChoice bukkit) { - if (bukkit instanceof RecipeChoice.MaterialChoice) { - return new net.minecraft.server.RecipeItemStack(((RecipeChoice.MaterialChoice) bukkit).getChoices().stream().map((mat) -> new net.minecraft.server.RecipeItemStack.StackProvider(CraftItemStack.asNMSCopy(new ItemStack(mat))))); + if (bukkit == null) { + return RecipeItemStack.a; + } else if (bukkit instanceof RecipeChoice.MaterialChoice) { + return new RecipeItemStack(((RecipeChoice.MaterialChoice) bukkit).getChoices().stream().map((mat) -> new net.minecraft.server.RecipeItemStack.StackProvider(CraftItemStack.asNMSCopy(new ItemStack(mat))))); } else { throw new IllegalArgumentException("Unknown recipe stack instance " + bukkit); }