mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
Add predicate to recipe's ExactChoice ingredient
This commit is contained in:
committed by
granny
parent
97d90df5da
commit
32db32c5ae
@@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/world/item/crafting/Ingredient.java
|
||||
+++ b/net/minecraft/world/item/crafting/Ingredient.java
|
||||
@@ -36,6 +_,7 @@
|
||||
// CraftBukkit start
|
||||
@javax.annotation.Nullable
|
||||
private java.util.Set<ItemStack> itemStacks; // Paper - Improve exact choice recipe ingredients
|
||||
+ public Predicate<org.bukkit.inventory.ItemStack> predicate; // Purpur - Add predicate to recipe's ExactChoice ingredient
|
||||
|
||||
public boolean isExact() {
|
||||
return this.itemStacks != null;
|
||||
@@ -87,6 +_,11 @@
|
||||
if (this.isExact()) {
|
||||
return this.itemStacks.contains(stack); // Paper - Improve exact choice recipe ingredients (hashing FTW!)
|
||||
}
|
||||
+ // Purpur start - Add predicate to recipe's ExactChoice ingredient
|
||||
+ if (predicate != null) {
|
||||
+ return predicate.test(stack.asBukkitCopy());
|
||||
+ }
|
||||
+ // Purpur end - Add predicate to recipe's ExactChoice ingredient
|
||||
// CraftBukkit end
|
||||
return stack.is(this.values);
|
||||
}
|
||||
Reference in New Issue
Block a user