summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-09-01 14:12:20 +1000
committermd_5 <git@md-5.net>2018-09-01 14:12:20 +1000
commitdc69d2b3db466073cff0243bb8c342715dc88e2e (patch)
tree63418120d75b15adacd64c1181d2c2fbe938205a /src
parent4c219e2a1206225cff4b34669c00106b1c312991 (diff)
downloadcraftbukkit-dc69d2b3db466073cff0243bb8c342715dc88e2e.tar
craftbukkit-dc69d2b3db466073cff0243bb8c342715dc88e2e.tar.gz
craftbukkit-dc69d2b3db466073cff0243bb8c342715dc88e2e.tar.lz
craftbukkit-dc69d2b3db466073cff0243bb8c342715dc88e2e.tar.xz
craftbukkit-dc69d2b3db466073cff0243bb8c342715dc88e2e.zip
Fix unbound shaped recipe ingredients
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java7
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);
}