Files
Shiroha/shiroha-server/minecraft-patches/features/0064-Leaf-Optimize-PatchedDataComponentMap-equals.patch
T
NanaChiyo0721 1bb895c165
Shiroha CI / build (push) Canceled after 0s
Shiroha CI / Event File (push) Canceled after 0s
Fix incorrect ticket lock size computing
Yeah this would fully solve the issue of chunk unloading race condition

The same fix was already initially added at "Force clamp grid-exponent to 1~6"
2026-08-09 14:57:32 +08:00

37 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Sat, 2 May 2026 22:26:57 +0800
Subject: [PATCH] Leaf Optimize PatchedDataComponentMap equals
This is a part of Leaf(https://github.com/Winds-Studio/Leaf/blob/db41340915c7768d726342fb29d16bc428081074/leaf-server/minecraft-patches/features/0300-Optimize-PatchedDataComponentMap-equals.patch)
Original author: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Original license: https://github.com/Winds-Studio/Leaf/blob/db41340915c7768d726342fb29d16bc428081074/LICENSE.md
diff --git a/net/minecraft/core/component/PatchedDataComponentMap.java b/net/minecraft/core/component/PatchedDataComponentMap.java
index e1397bb21b20a4be1223d12eb1f50677cd9f39d5..218a8e1d2447f18e864c7a917fd26881acd020f3 100644
--- a/net/minecraft/core/component/PatchedDataComponentMap.java
+++ b/net/minecraft/core/component/PatchedDataComponentMap.java
@@ -222,7 +222,19 @@ public final class PatchedDataComponentMap implements DataComponentMap, org.leav
@Override
public boolean equals(final Object obj) {
- return this == obj || obj instanceof PatchedDataComponentMap otherMap && this.prototype.equals(otherMap.prototype) && this.patch.equals(otherMap.patch);
+ // return this == obj || obj instanceof PatchedDataComponentMap otherMap && this.prototype.equals(otherMap.prototype) && this.patch.equals(otherMap.patch); // Leaf - Optimize PatchedDataComponentMap equals
+ // Leaf start - Optimize PatchedDataComponentMap equals
+ if (this == obj) return true;
+ if (!(obj instanceof PatchedDataComponentMap that)) return false;
+ if (this.patch.size() != that.patch.size()) {
+ return false;
+ }
+ if (!this.prototype.equals(that.prototype)) {
+ return false;
+ }
+ if (this.patch == that.patch) return true;
+ return this.patch.equals(that.patch);
+ // Leaf end - Optimize PatchedDataComponentMap equals
}
@Override