From 544ceb200c583ed3709fc0efd04a26cc1fa0a301 Mon Sep 17 00:00:00 2001 From: partydev Date: Sun, 24 Nov 2024 18:41:16 -0800 Subject: [PATCH] Compare custom model data first in exact recipes --- ...om-model-data-first-in-exact-recipes.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 patches/server/1074-Compare-custom-model-data-first-in-exact-recipes.patch diff --git a/patches/server/1074-Compare-custom-model-data-first-in-exact-recipes.patch b/patches/server/1074-Compare-custom-model-data-first-in-exact-recipes.patch new file mode 100644 index 000000000000..a2f854075a3f --- /dev/null +++ b/patches/server/1074-Compare-custom-model-data-first-in-exact-recipes.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: partydev +Date: Sun, 24 Nov 2024 18:40:27 -0800 +Subject: [PATCH] Compare custom model data first in exact recipes + + +diff --git a/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java b/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java +index caaad8f54fb892dfd6c7d4e02ab9c32997f89a6a..2ee6bb8b789eae4afa6a6a0567e668c76cbdf0b9 100644 +--- a/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java ++++ b/src/main/java/io/papermc/paper/inventory/recipe/ItemOrExact.java +@@ -46,6 +46,14 @@ public sealed interface ItemOrExact permits ItemOrExact.Item, ItemOrExact.Exact + + @Override + public boolean matches(final ItemStack stack) { ++ // Paper start - Compare custom model data first in exact recipes ++ if (this.stack.getBukkitStack().hasItemMeta() && this.stack.getBukkitStack().getItemMeta().hasCustomModelData()) { ++ if (!stack.getBukkitStack().hasItemMeta() || !stack.getBukkitStack().getItemMeta().hasCustomModelData()) { ++ return false; ++ } ++ return ItemStack.isSameItem(this.stack, stack) && this.stack.getBukkitStack().getItemMeta().getCustomModelData() == stack.getBukkitStack().getItemMeta().getCustomModelData(); ++ } ++ // Paper end - Compare custom model data first in exact recipes + return ItemStack.isSameItemSameComponents(this.stack, stack); + } +