diff options
author | Jake Potrebic <[email protected]> | 2023-12-08 11:00:39 -0800 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2023-12-08 11:00:39 -0800 |
commit | 2f92d4e00ecc4be92089a1494097aaba0ce82fff (patch) | |
tree | f7db33ffd937bff789a9a24f3f45631f836ce38b /patches/api/0447-Remove-unnecessary-durability-check-in-ItemStack-isS.patch | |
parent | f9edc4b1cd667da4f597b94fd1f25f9df69944b3 (diff) | |
download | Paper-2f92d4e00ecc4be92089a1494097aaba0ce82fff.tar.gz Paper-2f92d4e00ecc4be92089a1494097aaba0ce82fff.zip |
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs
bc145b90 PR-940: Create registry for banner pattern and cat type
CraftBukkit Changes:
cb2ea54de SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways
4fea66e44 PR-1299: Add new PersistentDataContainer methods and clean up docs
b483a20db PR-1303: Create registry for banner pattern and cat type
4642dd526 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
Diffstat (limited to 'patches/api/0447-Remove-unnecessary-durability-check-in-ItemStack-isS.patch')
-rw-r--r-- | patches/api/0447-Remove-unnecessary-durability-check-in-ItemStack-isS.patch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/api/0447-Remove-unnecessary-durability-check-in-ItemStack-isS.patch b/patches/api/0447-Remove-unnecessary-durability-check-in-ItemStack-isS.patch new file mode 100644 index 0000000000..215fc0e435 --- /dev/null +++ b/patches/api/0447-Remove-unnecessary-durability-check-in-ItemStack-isS.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR <[email protected]> +Date: Sun, 26 Nov 2023 20:00:50 -0300 +Subject: [PATCH] Remove unnecessary durability check in + "ItemStack#isSimilar(...)" + +By removing this check we avoid unnecessarily allocating useless `ItemMeta` objects if we are comparing two items, or one of the two items, that don't have any durability. Don't worry, the durability of the item is checked when it checks if both item metas are equal. + +This is a leftover from when checking for the item's durability was "free" because the durability was stored in the `ItemStack` itself, this [was changed in Minecraft 1.13](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/f8b2086d60942eb2cd7ac25a2a1408cb790c222c#src/main/java/org/bukkit/inventory/ItemStack.java). + +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 0af73cc04edb93b9772136d4d808f657ea40e733..36e3fbc727cd748aa138f52976154ba32954cd87 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -295,7 +295,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + return true; + } + Material comparisonType = (this.type.isLegacy()) ? Bukkit.getUnsafe().fromLegacy(this.getData(), true) : this.type; // This may be called from legacy item stacks, try to get the right material +- return comparisonType == stack.getType() && getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); ++ return comparisonType == stack.getType() && /* getDurability() == stack.getDurability() && */hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); // Paper - remove redundant item durability check + } + + @NotNull |