Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding PredicateChoice to Paper API (updated version) #12017

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
add Nullable annotation
marked stackPredicate field in Ingredient as Nullable
CPieter committed Jan 28, 2025
commit ff64957cca20e0ab0dca5c38a32f304e9cdedfb5
Original file line number Diff line number Diff line change
@@ -341,7 +341,7 @@ index 6bbe2e51ef71d193e0a5d3cace2b0ad1760ce759..83ccde54c625d40dc595e000c533f60a
}

diff --git a/net/minecraft/world/item/crafting/Ingredient.java b/net/minecraft/world/item/crafting/Ingredient.java
index 588ce2c00678bf73828669b91c272b99e6702634..e5b32b56c03a96bac0fef9c49644b5a6b9a9a140 100644
index 4ed4f4a3ee7df461ccedcf3506ccadcd27d45f94..0f1b550a1eec081f906acdd33984f2b4b0846005 100644
--- a/net/minecraft/world/item/crafting/Ingredient.java
+++ b/net/minecraft/world/item/crafting/Ingredient.java
@@ -21,7 +21,7 @@ import net.minecraft.world.item.Items;
@@ -353,7 +353,7 @@ index 588ce2c00678bf73828669b91c272b99e6702634..e5b32b56c03a96bac0fef9c49644b5a6
public static final StreamCodec<RegistryFriendlyByteBuf, Ingredient> CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM)
.map(Ingredient::new, ingredient -> ingredient.values);
public static final StreamCodec<RegistryFriendlyByteBuf, Optional<Ingredient>> OPTIONAL_CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM)
@@ -36,20 +36,24 @@ public final class Ingredient implements StackedContents.IngredientInfo<Holder<I
@@ -37,20 +37,24 @@ public final class Ingredient implements StackedContents.IngredientInfo<Holder<I
public Predicate<ItemStack> stackPredicate; // Paper - add PredicateChoice
// CraftBukkit start
@javax.annotation.Nullable
@@ -381,7 +381,7 @@ index 588ce2c00678bf73828669b91c272b99e6702634..e5b32b56c03a96bac0fef9c49644b5a6
return recipe;
}
// CraftBukkit end
@@ -87,21 +91,22 @@ public final class Ingredient implements StackedContents.IngredientInfo<Holder<I
@@ -88,21 +92,22 @@ public final class Ingredient implements StackedContents.IngredientInfo<Holder<I
// Paper end - add PredicateChoice
// CraftBukkit start
if (this.isExact()) {
@@ -413,7 +413,7 @@ index 588ce2c00678bf73828669b91c272b99e6702634..e5b32b56c03a96bac0fef9c49644b5a6
}

@Override
@@ -126,6 +131,11 @@ public final class Ingredient implements StackedContents.IngredientInfo<Holder<I
@@ -127,6 +132,11 @@ public final class Ingredient implements StackedContents.IngredientInfo<Holder<I
}

public SlotDisplay display() {
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
--- a/net/minecraft/world/item/crafting/Ingredient.java
+++ b/net/minecraft/world/item/crafting/Ingredient.java
@@ -33,6 +_,26 @@
@@ -33,6 +_,27 @@
public static final Codec<Ingredient> CODEC = ExtraCodecs.nonEmptyHolderSet(NON_AIR_HOLDER_SET_CODEC)
.xmap(Ingredient::new, ingredient -> ingredient.values);
private final HolderSet<Item> values;
+ @org.jetbrains.annotations.Nullable
+ public Predicate<ItemStack> stackPredicate; // Paper - add PredicateChoice
+ // CraftBukkit start
+ @javax.annotation.Nullable