9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-22 16:39:22 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0087-Optimize-matching-item-checks.patch
Dreeam 8b8cc98e30 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@cdad49b7 Do not mark plugin tickets as forced; keep correct ticket types
PaperMC/Paper@a1c4fc96 Add generic ticket identifier
PaperMC/Paper@745881bb Update Moonrise common for 1.21.5
PaperMC/Paper@e9d00eb6 Apply Moonrise patch
PaperMC/Paper@ef0f0d10 Copy Moonrise 1.21.5 update over
PaperMC/Paper@cc0f25cb Apply more feature patches
PaperMC/Paper@e7b684ed fix
PaperMC/Paper@71ccae07 Revert "move block data/state impl"
2025-04-02 16:27:31 -04: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 25c806ca9abebdaa6031e3f350fdf1c7deac7c4e..3eb34df6bd4c4969ffbcc7abd1c24e556485d1c4 100644
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -889,11 +889,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) {