Correctly mirror vanilla non-exact ingredients (#11651)

This commit is contained in:
Bjarne Koll 2024-11-23 20:37:38 +01:00
parent 0dc6316e04
commit e598ee5d08

View File

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ int getMaxStackSize(); + int getMaxStackSize();
+ +
+ boolean is(ItemStack stack); + boolean matches(ItemStack stack);
+ +
+ record Item(Holder<net.minecraft.world.item.Item> item) implements ItemOrExact { + record Item(Holder<net.minecraft.world.item.Item> item) implements ItemOrExact {
+ +
@ -40,8 +40,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ @Override + @Override
+ public boolean is(final ItemStack stack) { + public boolean matches(final ItemStack stack) {
+ return stack.is(this.item); + return stack.is(this.item) && stack.getComponentsPatch().isEmpty();
+ } + }
+ +
+ @Override + @Override
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ @Override + @Override
+ public boolean is(final ItemStack stack) { + public boolean matches(final ItemStack stack) {
+ return ItemStack.isSameItemSameComponents(this.stack, stack); + return ItemStack.isSameItemSameComponents(this.stack, stack);
+ } + }
+ +
@ -209,7 +209,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ItemStack itemstack = (ItemStack) this.items.get(i); ItemStack itemstack = (ItemStack) this.items.get(i);
- if (!itemstack.isEmpty() && itemstack.is(item) && Inventory.isUsableForCrafting(itemstack)) { - if (!itemstack.isEmpty() && itemstack.is(item) && Inventory.isUsableForCrafting(itemstack)) {
+ if (!itemstack.isEmpty() && item.is(itemstack) && (!(item instanceof io.papermc.paper.inventory.recipe.ItemOrExact.Item) || isUsableForCrafting(itemstack))) { // Paper - Improve exact choice recipe ingredients + if (!itemstack.isEmpty() && item.matches(itemstack) && (!(item instanceof io.papermc.paper.inventory.recipe.ItemOrExact.Item) || isUsableForCrafting(itemstack))) { // Paper - Improve exact choice recipe ingredients
return i; return i;
} }
} }