mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
add back pufferfish patches \o/
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
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 7c29750e534eae4266bf7a63c50e3827401d6569..e8e9a3370ba07dc0ca47c8352f6f04a449f2268f 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
@@ -36,6 +36,7 @@ public final class Ingredient implements Predicate<ItemStack> {
|
||||
@Nullable
|
||||
private IntList stackingIds;
|
||||
public boolean exact; // CraftBukkit
|
||||
+ public Predicate<org.bukkit.inventory.ItemStack> predicate; // Purpur
|
||||
public static final Codec<Ingredient> CODEC = Ingredient.codec(true);
|
||||
public static final Codec<Ingredient> CODEC_NONEMPTY = Ingredient.codec(false);
|
||||
|
||||
@@ -67,6 +68,12 @@ public final class Ingredient implements Predicate<ItemStack> {
|
||||
} else if (this.isEmpty()) {
|
||||
return itemstack.isEmpty();
|
||||
} else {
|
||||
+ // Purpur start
|
||||
+ if (predicate != null) {
|
||||
+ return predicate.test(itemstack.asBukkitCopy());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
ItemStack[] aitemstack = this.getItems();
|
||||
int i = aitemstack.length;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
index 13d25d118eb4d3ef35a4cdfb9bbde9ed83f6c04b..553ecc9b5631ffc0848a798bb3295f16d1722c1f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
@@ -30,6 +30,7 @@ public interface CraftRecipe extends Recipe {
|
||||
} else if (bukkit instanceof RecipeChoice.ExactChoice) {
|
||||
stack = new Ingredient(((RecipeChoice.ExactChoice) bukkit).getChoices().stream().map((mat) -> new net.minecraft.world.item.crafting.Ingredient.ItemValue(CraftItemStack.asNMSCopy(mat))));
|
||||
stack.exact = true;
|
||||
+ stack.predicate = ((RecipeChoice.ExactChoice) bukkit).getPredicate(); // Purpur
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown recipe stack instance " + bukkit);
|
||||
}
|
||||
Reference in New Issue
Block a user