mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
Fix unbound shaped recipe ingredients
This commit is contained in:
parent
4c219e2a12
commit
dc69d2b3db
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user