From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Sat, 3 Oct 2020 17:40:52 -0500 Subject: [PATCH] Add predicate to recipe's ExactChoice ingredient diff --git a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java index 0b0054b3d5d56ba24e1aee0e3ab56ea5b01a82a8..2e3a834643d56543418e9b9beb9d3448bf059d22 100644 --- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java +++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java @@ -45,6 +45,7 @@ public final class Ingredient implements StackedContents.IngredientInfo itemStacks; // Paper - Improve exact choice recipe ingredients + public Predicate predicate; // Purpur public boolean isExact() { return this.itemStacks != null; @@ -100,6 +101,11 @@ public final class Ingredient implements StackedContents.IngredientInfo CraftItemType.bukkitToMinecraft(mat))); } else if (bukkit instanceof RecipeChoice.ExactChoice) { stack = Ingredient.ofStacks(((RecipeChoice.ExactChoice) bukkit).getChoices().stream().map((mat) -> CraftItemStack.asNMSCopy(mat)).toList()); + stack.predicate = ((RecipeChoice.ExactChoice) bukkit).getPredicate(); // Purpur // Paper start - support "empty" choices - legacy method that spigot might incorrectly call // Their impl of Ingredient.of() will error, ingredients need at least one entry. // Callers running into this exception may have passed an incorrect empty() recipe choice to a non-empty slot or