forked from PaperMC/Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compare custom model data first in exact recipes
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
patches/server/1074-Compare-custom-model-data-first-in-exact-recipes.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|