mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 0514fc4e2 Add missing effects 8f5d9effd Add getMainThreadExecutor to BukkitScheduler 313b5020b Allow adding items to BlockDropItemEvent (#5093) 9a556d9da [CI-SKIP] [Auto] Rebuild Patches 72b2768ad Inline shift fields in EnumDirection (#5082) ffff53fa7 added option to disable pathfinding updates on block changes (#5123) b67081fd7 add DragonEggFormEvent (fixes #5110) (#5112) 3eefafbaf Fix javadoc build 0081ed1c4 Add javadoc step to GH Actions 01082503e Add dropLeash variable to EntityUnleashEvent (#5130) 31f9f869a [CI-SKIP] Fix YourKit links in readme, fixes #5091 8ac27aa38 [Auto] Updated Upstream (CraftBukkit) c4d9cc831 [Auto] Updated Upstream (Bukkit/CraftBukkit) d0477d326 [Auto] Updated Upstream (CraftBukkit) d9f5f7018 EntityMoveEvent (#4614)
44 lines
2.4 KiB
Diff
44 lines
2.4 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/server/RecipeItemStack.java b/src/main/java/net/minecraft/server/RecipeItemStack.java
|
|
index 0f96abd0ca78e9c78306fed69684dee71be37703..f6d92949409b66d5d0c578e010aebd058903c6fa 100644
|
|
--- a/src/main/java/net/minecraft/server/RecipeItemStack.java
|
|
+++ b/src/main/java/net/minecraft/server/RecipeItemStack.java
|
|
@@ -26,6 +26,7 @@ public final class RecipeItemStack implements Predicate<ItemStack> {
|
|
public ItemStack[] choices;
|
|
private IntList d;
|
|
public boolean exact; // CraftBukkit
|
|
+ public Predicate<org.bukkit.inventory.ItemStack> predicate; // Purpur
|
|
|
|
public RecipeItemStack(Stream<? extends RecipeItemStack.Provider> stream) {
|
|
this.b = (RecipeItemStack.Provider[]) stream.toArray((i) -> {
|
|
@@ -52,6 +53,12 @@ public final class RecipeItemStack implements Predicate<ItemStack> {
|
|
if (this.choices.length == 0) {
|
|
return itemstack.isEmpty();
|
|
} else {
|
|
+ // Purpur start
|
|
+ if (predicate != null) {
|
|
+ return predicate.test(itemstack.asBukkitCopy());
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
ItemStack[] aitemstack = this.choices;
|
|
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 ef29599a89bc630899c65df9a7004f836787d95e..18413e6327458c6d60d2a0ca8167fc5d75389934 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
|
@@ -22,6 +22,7 @@ public interface CraftRecipe extends Recipe {
|
|
} else if (bukkit instanceof RecipeChoice.ExactChoice) {
|
|
stack = new RecipeItemStack(((RecipeChoice.ExactChoice) bukkit).getChoices().stream().map((mat) -> new net.minecraft.server.RecipeItemStack.StackProvider(CraftItemStack.asNMSCopy(mat))));
|
|
stack.exact = true;
|
|
+ stack.predicate = ((RecipeChoice.ExactChoice) bukkit).getPredicate(); // Purpur
|
|
} else {
|
|
throw new IllegalArgumentException("Unknown recipe stack instance " + bukkit);
|
|
}
|