diff --git a/patches/server/0128-Optimize-identical-item-checks.patch b/patches/server/0128-Optimize-identical-item-checks.patch new file mode 100644 index 0000000..445dde1 --- /dev/null +++ b/patches/server/0128-Optimize-identical-item-checks.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 20:51:32 +0100 +Subject: [PATCH] Optimize identical item checks + +License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index b1a01ef0090718923aff4365d8e93c776a5ebae4..c2160103d34c07f27cccf94613b9ae34dcd0c154 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -705,14 +705,29 @@ public final class ItemStack { + } + + public static boolean tagMatches(ItemStack left, ItemStack right) { ++ // Gale start - optimize identical item checks ++ if (left == right) { ++ return true; ++ } ++ // Gale end - optimize identical item checks + return left.isEmpty() && right.isEmpty() ? true : (!left.isEmpty() && !right.isEmpty() ? (left.tag == null && right.tag != null ? false : left.tag == null || left.tag.equals(right.tag)) : false); + } + + public static boolean matches(ItemStack left, ItemStack right) { ++ // Gale start - optimize identical item checks ++ if (left == right) { ++ return true; ++ } ++ // Gale end - optimize identical item checks + return left.isEmpty() && right.isEmpty() ? true : (!left.isEmpty() && !right.isEmpty() ? left.matches(right) : false); + } + + private boolean matches(ItemStack stack) { ++ // Gale start - optimize identical item checks ++ if (this == stack) { ++ return true; ++ } ++ // Gale end - optimize identical item checks + return this.count != stack.count ? false : (!this.is(stack.getItem()) ? false : (this.tag == null && stack.tag != null ? false : this.tag == null || this.tag.equals(stack.tag))); + } + diff --git a/patches/server/0128-Reduce-RandomSource-instances.patch b/patches/server/0129-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0128-Reduce-RandomSource-instances.patch rename to patches/server/0129-Reduce-RandomSource-instances.patch diff --git a/patches/server/0129-Server-thread-priority-environment-variable.patch b/patches/server/0130-Server-thread-priority-environment-variable.patch similarity index 100% rename from patches/server/0129-Server-thread-priority-environment-variable.patch rename to patches/server/0130-Server-thread-priority-environment-variable.patch diff --git a/patches/server/0130-Thread-safety-annotations.patch b/patches/server/0131-Thread-safety-annotations.patch similarity index 100% rename from patches/server/0130-Thread-safety-annotations.patch rename to patches/server/0131-Thread-safety-annotations.patch diff --git a/patches/server/0131-CPU-cores-estimation.patch b/patches/server/0132-CPU-cores-estimation.patch similarity index 100% rename from patches/server/0131-CPU-cores-estimation.patch rename to patches/server/0132-CPU-cores-estimation.patch diff --git a/patches/server/0132-Mutex-utility.patch b/patches/server/0133-Mutex-utility.patch similarity index 100% rename from patches/server/0132-Mutex-utility.patch rename to patches/server/0133-Mutex-utility.patch diff --git a/patches/server/0133-Paired-lock-and-condition-utility.patch b/patches/server/0134-Paired-lock-and-condition-utility.patch similarity index 100% rename from patches/server/0133-Paired-lock-and-condition-utility.patch rename to patches/server/0134-Paired-lock-and-condition-utility.patch diff --git a/patches/server/0134-Unterminable-executor-utility.patch b/patches/server/0135-Unterminable-executor-utility.patch similarity index 100% rename from patches/server/0134-Unterminable-executor-utility.patch rename to patches/server/0135-Unterminable-executor-utility.patch diff --git a/patches/server/0135-FIFO-concurrent-queue-utility.patch b/patches/server/0136-FIFO-concurrent-queue-utility.patch similarity index 100% rename from patches/server/0135-FIFO-concurrent-queue-utility.patch rename to patches/server/0136-FIFO-concurrent-queue-utility.patch diff --git a/patches/server/0136-Base-thread-pools.patch b/patches/server/0137-Base-thread-pools.patch similarity index 100% rename from patches/server/0136-Base-thread-pools.patch rename to patches/server/0137-Base-thread-pools.patch diff --git a/patches/server/0137-Non-blocking-PooledObjects.patch b/patches/server/0138-Non-blocking-PooledObjects.patch similarity index 100% rename from patches/server/0137-Non-blocking-PooledObjects.patch rename to patches/server/0138-Non-blocking-PooledObjects.patch