mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-30 20:39:21 +00:00
ClassInstanceMultiMap belongs to Minecraft vanilla entity storage. And is unused, since replaced by spottedleaf's entity storage (rewrite chunk system). However these patches might be useful for vanilla entity storage if is used.
27 lines
1.4 KiB
Diff
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 8803c03846828b532bd2b6e164c589995907c96b..3acc2ae8533f19a6f9b2b6a1d96271f1047384a4 100644
|
|
--- a/net/minecraft/world/item/ItemStack.java
|
|
+++ b/net/minecraft/world/item/ItemStack.java
|
|
@@ -868,11 +868,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) {
|