9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-23 00:49:31 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0085-Optimize-matching-item-checks.patch
Dreeam ccf2f9c0d2 Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@a9399451 Fixup sendAllDataToRemote calls
PaperMC/Paper@cb47e018 Remove more dead code, fix pre-existing desync when cancelling and closing container
PaperMC/Paper@40764534 Specify the class loader when loading services (#12829)
PaperMC/Paper@1bf6364b Update Mache for horse decompile fix
PaperMC/Paper@76fb5060 Add vanilla error message to precondition for DialogBaseImpl (#12831)

Purpur Changes:
PurpurMC/Purpur@5b26bab8 Updated Upstream (Paper)
PurpurMC/Purpur@8734844b sigh...
PurpurMC/Purpur@09ea9cb9 fix mobs not burning in daylight (#1689)
PurpurMC/Purpur@4d5a8e6e Updated Upstream (Paper)
PurpurMC/Purpur@7dbe4153 Add support for "/chase", a disabled Minecraft command. (#1690)
PurpurMC/Purpur@11c030a8 Updated Upstream (Paper)
2025-07-12 18:14:29 +08:00

27 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Sun, 25 Dec 2022 20:51:32 +0100
Subject: [PATCH] Optimize matching item checks
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
index 951c86278e8cb5cd801a5db2ebfabef8c6d813ef..6ceb6cf302bad28e453fa89ec16083b0e0c5c398 100644
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -864,11 +864,11 @@ public final class ItemStack implements DataComponentHolder {
}
public static boolean isSameItem(ItemStack stack, ItemStack other) {
- return stack.is(other.getItem());
+ return stack == other || stack.is(other.getItem()); // Gale - optimize identical item checks
}
public static boolean isSameItemSameComponents(ItemStack stack, ItemStack other) {
- return stack.is(other.getItem()) && (stack.isEmpty() && other.isEmpty() || Objects.equals(stack.components, other.components));
+ return stack == other || stack.is(other.getItem()) && (stack.isEmpty() && other.isEmpty() || Objects.equals(stack.components, other.components)); // Gale - optimize identical item checks
}
public static MapCodec<ItemStack> lenientOptionalFieldOf(String fieldName) {