Skip to content

Commit

Permalink
Compare custom model data first in exact recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
partydev committed Nov 25, 2024
1 parent 30fffed commit 544ceb2
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: partydev <[email protected]>
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);
}

0 comments on commit 544ceb2

Please sign in to comment.