mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
it compiles \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 e314f36951e9ac15c57137e24fce8c410373130a..21dfb8e91c5427ac12133de2c05d923d87adf5ba 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
@@ -41,6 +41,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);
|
||||
|
||||
@@ -72,6 +73,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 6ba29875d78ede4aa7978ff689e588f7fed11528..4afec4387971612f62b825e9e56c2ead7424a7c2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
@@ -29,6 +29,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