mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@1cc86be Update setup-gradle action PaperMC/Paper@b0d7153 fix item meta PaperMC/Paper@2206b9a fix components PaperMC/Paper@e73d396 fix asset id PaperMC/Paper@2a4ba00 add missing effect cause, for bee being poisoned PaperMC/Paper@4806ce5 properly override push/knockback methods PaperMC/Paper@bb4fb53 call EntityInsideBlockEvent for eyeblossom PaperMC/Paper@ae060b3 Finish PlayerPickItemEvent PaperMC/Paper@c54c062 Port exact choice improvements (#11705) PaperMC/Paper@e4e24f3 Move around patches again PaperMC/Paper@4c39ea2 More moving around of hunks PaperMC/Paper@77afb9a Add new bundle animation (#11708) PaperMC/Paper@346b9b8 Fixup PlayerPickItemEvent docs more PaperMC/Paper@d4630f1 Fix broken joml metadata resulting in kotlin being included on compile/runtime classpath (#11712)
43 lines
2.7 KiB
Diff
43 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
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<io.paper
|
|
// CraftBukkit start
|
|
@Nullable
|
|
private java.util.Set<ItemStack> itemStacks; // Paper - Improve exact choice recipe ingredients
|
|
+ public Predicate<org.bukkit.inventory.ItemStack> predicate; // Purpur
|
|
|
|
public boolean isExact() {
|
|
return this.itemStacks != null;
|
|
@@ -100,6 +101,11 @@ public final class Ingredient implements StackedContents.IngredientInfo<io.paper
|
|
if (this.isExact()) {
|
|
return this.itemStacks.contains(itemstack); // Paper - Improve exact choice recipe ingredients (hashing FTW!)
|
|
}
|
|
+ // Purpur start
|
|
+ if (predicate != null) {
|
|
+ return predicate.test(itemstack.asBukkitCopy());
|
|
+ }
|
|
+ // Purpur end
|
|
// CraftBukkit end
|
|
return itemstack.is(this.values);
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
|
index 4864e2016cb1d377425297fd1c52b383632cb59e..fc0e93a936dadb0dca758207297f92a22f3955d4 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
|
@@ -36,6 +36,7 @@ public interface CraftRecipe extends Recipe {
|
|
stack = Ingredient.of(((RecipeChoice.MaterialChoice) bukkit).getChoices().stream().map((mat) -> 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
|