diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java | 7 |
1 files 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 eec606b2..3a704d10 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); } |