This is a part of Leaf(https://github.com/Winds-Studio/Leaf/blob/8293ae2d0ada9df24e944f755b50e93208c1496d/leaf-server/minecraft-patches/features/0281-Lithium-faster-hash-palette.patch) Original proj license: https://github.com/Winds-Studio/Leaf/blob/8293ae2d0ada9df24e944f755b50e93208c1496d/LICENSE.md This patch is based on the following mixins: * "net/caffeinemc/mods/lithium/mixin/chunk/palette/StrategyMixin.java" By: 2No2Name <2No2Name@web.de> As part of: Lithium (https://github.com/CaffeineMC/lithium) Licensed under: LGPL-3.0-only (https://www.gnu.org/licenses/lgpl-3.0.html)
27 lines
1.4 KiB
Diff
27 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <mrhua269@gmail.com>
|
|
Date: Thu, 4 Jun 2026 17:34:43 +0800
|
|
Subject: [PATCH] Gale: Optimize matching item checks
|
|
|
|
License: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://github.com/GaleMC/Gale
|
|
|
|
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
|
index b507be6db077a0c9b77270f3359b0908c9298c71..a2c178c400e54807e2da0b45ca166ac4d3d26971 100644
|
|
--- a/net/minecraft/world/item/ItemStack.java
|
|
+++ b/net/minecraft/world/item/ItemStack.java
|
|
@@ -841,11 +841,11 @@ public final class ItemStack implements DataComponentHolder, ItemInstance, Chang
|
|
}
|
|
|
|
public static boolean isSameItem(final ItemStack a, final ItemStack b) {
|
|
- return a.is(b.getItem());
|
|
+ return a == b || a.is(b.getItem()); // Gale - optimize identical item checks
|
|
}
|
|
|
|
public static boolean isSameItemSameComponents(final ItemStack a, final ItemStack b) {
|
|
- return a.is(b.getItem()) && (a.isEmpty() && b.isEmpty() || Objects.equals(a.components, b.components));
|
|
+ return a == b || a.is(b.getItem()) && (a.isEmpty() && b.isEmpty() || Objects.equals(a.components, b.components)); // Gale - optimize identical item checks
|
|
}
|
|
|
|
public static boolean matchesIgnoringComponents(final ItemStack a, final ItemStack b, final Predicate<DataComponentType<?>> ignoredPredicate) {
|