37 lines
2.0 KiB
Diff
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 e59250af5d769076578017fb880e9168bc720947..ae355b2d92090e89ab4671ff13f77d632e7dfcf9 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
|