diff options
author | Jake Potrebic <[email protected]> | 2024-06-17 10:50:50 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-06-17 10:50:50 -0700 |
commit | 92e0b1c0b69a3aef96ac7ea0af8d05959bad2d8e (patch) | |
tree | 25ecd6376d4203147b0a9e81e286608547008cb8 | |
parent | 55fb24b33f770ea8ebb04250e0c2052ec6adc9c6 (diff) | |
download | Paper-92e0b1c0b69a3aef96ac7ea0af8d05959bad2d8e.tar.gz Paper-92e0b1c0b69a3aef96ac7ea0af8d05959bad2d8e.zip |
small tweak to CraftItemStack#hashCode
-rw-r--r-- | patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch | 15 | ||||
-rw-r--r-- | patches/server/1025-Make-a-PDC-view-accessible-directly-from-ItemStack.patch | 4 |
2 files changed, 9 insertions, 10 deletions
diff --git a/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch b/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch index 2683d879d1..bc216c4936 100644 --- a/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch +++ b/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Proxy ItemStack to CraftItemStack diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index be36336a3c7d1ae88277f4ee1be70075001de7a7..85c54534b9fa3173ebb513382bebe2d1ea5936b5 100644 +index be36336a3c7d1ae88277f4ee1be70075001de7a7..0cf6c0f6371c61d2e3ef240415d81554a81190d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -25,15 +25,58 @@ import org.bukkit.material.MaterialData; +@@ -25,15 +25,57 @@ import org.bukkit.material.MaterialData; @DelegateDeserialization(ItemStack.class) public final class CraftItemStack extends ItemStack { @@ -43,8 +43,7 @@ index be36336a3c7d1ae88277f4ee1be70075001de7a7..85c54534b9fa3173ebb513382bebe2d1 + if (this.handle == null || this.handle.isEmpty()) { + return net.minecraft.world.item.ItemStack.EMPTY.hashCode(); + } else { -+ int hash = 1; -+ hash = hash * 31 + net.minecraft.world.item.ItemStack.hashItemAndComponents(this.handle); ++ int hash = net.minecraft.world.item.ItemStack.hashItemAndComponents(this.handle); + hash = hash * 31 + this.handle.getCount(); + return hash; + } @@ -72,7 +71,7 @@ index be36336a3c7d1ae88277f4ee1be70075001de7a7..85c54534b9fa3173ebb513382bebe2d1 public static net.minecraft.world.item.ItemStack getOrCloneOnMutation(ItemStack old, ItemStack newInstance) { return old == newInstance ? unwrap(old) : asNMSCopy(newInstance); } -@@ -47,25 +90,13 @@ public final class CraftItemStack extends ItemStack { +@@ -47,25 +89,13 @@ public final class CraftItemStack extends ItemStack { // Paper end - override isEmpty to use vanilla's impl public static net.minecraft.world.item.ItemStack asNMSCopy(ItemStack original) { @@ -103,7 +102,7 @@ index be36336a3c7d1ae88277f4ee1be70075001de7a7..85c54534b9fa3173ebb513382bebe2d1 } // Paper start -@@ -88,14 +119,10 @@ public final class CraftItemStack extends ItemStack { +@@ -88,14 +118,10 @@ public final class CraftItemStack extends ItemStack { * Copies the NMS stack to return as a strictly-Bukkit stack */ public static ItemStack asBukkitCopy(net.minecraft.world.item.ItemStack original) { @@ -122,7 +121,7 @@ index be36336a3c7d1ae88277f4ee1be70075001de7a7..85c54534b9fa3173ebb513382bebe2d1 } public static CraftItemStack asCraftMirror(net.minecraft.world.item.ItemStack original) { -@@ -313,11 +340,7 @@ public final class CraftItemStack extends ItemStack { +@@ -313,11 +339,7 @@ public final class CraftItemStack extends ItemStack { @Override public CraftItemStack clone() { @@ -135,7 +134,7 @@ index be36336a3c7d1ae88277f4ee1be70075001de7a7..85c54534b9fa3173ebb513382bebe2d1 } @Override -@@ -420,22 +443,14 @@ public final class CraftItemStack extends ItemStack { +@@ -420,22 +442,14 @@ public final class CraftItemStack extends ItemStack { if (stack == this) { return true; } diff --git a/patches/server/1025-Make-a-PDC-view-accessible-directly-from-ItemStack.patch b/patches/server/1025-Make-a-PDC-view-accessible-directly-from-ItemStack.patch index 6920712589..4ee70dccd4 100644 --- a/patches/server/1025-Make-a-PDC-view-accessible-directly-from-ItemStack.patch +++ b/patches/server/1025-Make-a-PDC-view-accessible-directly-from-ItemStack.patch @@ -97,10 +97,10 @@ index 0000000000000000000000000000000000000000..fac401280d3f3689b00e16c19155ca75 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 85c54534b9fa3173ebb513382bebe2d1ea5936b5..047b1bbada93056905d5a5d8d193d61d0bb84556 100644 +index 0cf6c0f6371c61d2e3ef240415d81554a81190d0..b6981c589695db7006165726d2ab5edce4a9f435 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -481,4 +481,63 @@ public final class CraftItemStack extends ItemStack { +@@ -480,4 +480,63 @@ public final class CraftItemStack extends ItemStack { return mirrored; } // Paper end |