3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-17 20:10:10 +01:00

Fix unbound shaped recipe ingredients

Dieser Commit ist enthalten in:
md_5 2018-09-01 14:12:20 +10:00
Ursprung 4c219e2a12
Commit dc69d2b3db

Datei anzeigen

@ -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);
}