mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
add back pufferfish patches
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 cd7ea0c16f9ddcb84b5d7e8a2533e6e84f3879c7..3ca086418ad037c48775db73d2b9c410acf1e326 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
@@ -39,6 +39,7 @@ public final class Ingredient implements Predicate<ItemStack> {
|
||||
@Nullable
|
||||
private IntList stackingIds;
|
||||
public boolean exact; // CraftBukkit
|
||||
+ public Predicate<org.bukkit.inventory.ItemStack> predicate;
|
||||
|
||||
public Ingredient(Stream<? extends Ingredient.Value> entries) {
|
||||
this.values = (Ingredient.Value[]) entries.toArray((i) -> {
|
||||
@@ -64,6 +65,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