From 52ff3b7382f1076dee9d3699fc38d4798e5a59b7 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 28 Apr 2024 18:08:59 +0100 Subject: [PATCH] Add itemName components (Resolves #10467) (#10471) * Add itemName components (Resolves ##10467) * improve javadocs and formatting * rebased --------- Co-authored-by: Jake Potrebic --- patches/api/0006-Adventure.patch | 61 +++++++++++++++++-- patches/api/0056-Fix-upstream-javadocs.patch | 4 +- .../0172-Fix-Spigot-annotation-mistakes.patch | 8 +-- .../0200-Support-components-in-ItemMeta.patch | 6 +- patches/server/0010-Adventure.patch | 23 ++++++- .../0027-Support-components-in-ItemMeta.patch | 8 +-- ...074-Handle-Item-Meta-Inconsistencies.patch | 8 +-- ...m-getAttributeModifier-duplication-c.patch | 4 +- .../1034-Deep-clone-nbt-tags-in-PDC.patch | 4 +- patches/server/1041-Fix-ItemFlags.patch | 12 ++-- ...ve-checking-handled-tags-in-itemmeta.patch | 4 +- .../server/1045-General-ItemMeta-fixes.patch | 10 +-- 12 files changed, 112 insertions(+), 40 deletions(-) diff --git a/patches/api/0006-Adventure.patch b/patches/api/0006-Adventure.patch index e991609a01..26674a6554 100644 --- a/patches/api/0006-Adventure.patch +++ b/patches/api/0006-Adventure.patch @@ -4596,7 +4596,7 @@ index 9bab73c3c2ca759b8e1c7d07d98cc593c961666a..f0c6943da3f783101ca647b75b3230fa throw new UnsupportedOperationException("Not supported yet."); } diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876b94058b9 100644 +index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aeebb9a6fd6 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java @@ -34,6 +34,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste @@ -4644,7 +4644,60 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876 void setDisplayName(@Nullable String name); /** -@@ -124,6 +146,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -62,6 +84,32 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + */ + boolean hasItemName(); + ++ // Paper start ++ /** ++ * Gets the item name component that is set. ++ *
++ * Item name differs from display name in that it is cannot be edited by an ++ * anvil, is not styled with italics, and does not show labels. ++ *

++ * Plugins should check that {@link #hasItemName()} returns true before ++ * calling this method. ++ * ++ * @return the item name that is set ++ * @see #hasItemName() ++ */ ++ @org.jetbrains.annotations.NotNull ++ Component itemName(); ++ ++ /** ++ * Sets the item name. ++ *
++ * Item name differs from display name in that it is cannot be edited by an ++ * anvil, is not styled with italics, and does not show labels. ++ * ++ * @param name the name to set, null to remove it ++ */ ++ void itemName(@Nullable final Component name); ++ // Paper end + /** + * Gets the item name that is set. + *
+@@ -72,7 +120,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + * calling this method. + * + * @return the item name that is set ++ * @deprecated in favour of {@link #itemName()} + */ ++ @Deprecated // Paper + @NotNull + String getItemName(); + +@@ -83,7 +133,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + * anvil, is not styled with italics, and does not show labels. + * + * @param name the name to set ++ * @deprecated in favour of {@link #itemName(Component)} + */ ++ @Deprecated // Paper + void setItemName(@Nullable String name); + + /** +@@ -124,6 +176,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste */ boolean hasLore(); @@ -4669,7 +4722,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876 /** * Gets the lore that is set. *

-@@ -131,7 +171,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -131,7 +201,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste * calling this method. * * @return a list of lore that is set @@ -4679,7 +4732,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876 @Nullable List getLore(); -@@ -140,7 +182,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -140,7 +212,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste * Removes lore when given null. * * @param lore the lore that will be set diff --git a/patches/api/0056-Fix-upstream-javadocs.patch b/patches/api/0056-Fix-upstream-javadocs.patch index e296f8270e..1aa0e45854 100644 --- a/patches/api/0056-Fix-upstream-javadocs.patch +++ b/patches/api/0056-Fix-upstream-javadocs.patch @@ -1438,10 +1438,10 @@ index 07c3dff4d6190ef388d9c1e1c36f67f00a3e8e66..597a18a767b68b47e81454b7d44613c7 * @param input The input choice. * @return The changed recipe, so you can chain calls. diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index d7c178b3584db5866a5a21c6ddaab876b94058b9..dff32cedf47e95fe14a865898d76b62748dee5f3 100644 +index 18c2864c99d4dfae16cdb35143486aeebb9a6fd6..d66857825528ee772219440dffa28ad8e820493b 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -483,7 +483,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -513,7 +513,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste /** * Return an immutable copy of all {@link Attribute}s and their * {@link AttributeModifier}s for a given {@link EquipmentSlot}.
diff --git a/patches/api/0172-Fix-Spigot-annotation-mistakes.patch b/patches/api/0172-Fix-Spigot-annotation-mistakes.patch index c28ec02eed..6dc3d96c0b 100644 --- a/patches/api/0172-Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/0172-Fix-Spigot-annotation-mistakes.patch @@ -1587,10 +1587,10 @@ index 597a18a767b68b47e81454b7d44613c7178c1366..bc3440eb72127824b3961fbdae583bb6 public ItemStack getInput() { return this.ingredient.getItemStack(); diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index dff32cedf47e95fe14a865898d76b62748dee5f3..05a57b42e874c6e50149aa253861abaf5e17cef0 100644 +index d66857825528ee772219440dffa28ad8e820493b..3ddd52b135f339ff006b5d53f46487bfbe1ff7fd 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -111,6 +111,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -141,6 +141,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste /** * Checks for existence of a localized name. * @@ -1598,7 +1598,7 @@ index dff32cedf47e95fe14a865898d76b62748dee5f3..05a57b42e874c6e50149aa253861abaf * @return true if this has a localized name * @deprecated meta no longer exists */ -@@ -123,6 +124,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -153,6 +154,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste * Plugins should check that hasLocalizedName() returns true * before calling this method. * @@ -1606,7 +1606,7 @@ index dff32cedf47e95fe14a865898d76b62748dee5f3..05a57b42e874c6e50149aa253861abaf * @return the localized name that is set * @deprecated meta no longer exists */ -@@ -133,6 +135,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -163,6 +165,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste /** * Sets the localized name. * diff --git a/patches/api/0200-Support-components-in-ItemMeta.patch b/patches/api/0200-Support-components-in-ItemMeta.patch index def75da5ac..8a3122ea24 100644 --- a/patches/api/0200-Support-components-in-ItemMeta.patch +++ b/patches/api/0200-Support-components-in-ItemMeta.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Support components in ItemMeta diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index 05a57b42e874c6e50149aa253861abaf5e17cef0..ab69711ebd81fb512c7abebc5b439e89a4754bd2 100644 +index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566a97865cf 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java @@ -5,6 +5,7 @@ import java.util.Collection; @@ -54,7 +54,7 @@ index 05a57b42e874c6e50149aa253861abaf5e17cef0..ab69711ebd81fb512c7abebc5b439e89 /** * Checks for existence of an item name. *
-@@ -180,6 +205,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -210,6 +235,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste @Nullable List getLore(); @@ -74,7 +74,7 @@ index 05a57b42e874c6e50149aa253861abaf5e17cef0..ab69711ebd81fb512c7abebc5b439e89 /** * Sets the lore for this item. * Removes lore when given null. -@@ -190,6 +228,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste +@@ -220,6 +258,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste @Deprecated // Paper void setLore(@Nullable List lore); diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 19562689dd..3ba9b0bbf2 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -5141,7 +5141,7 @@ index 9c57b883783145ad4483481a2c2e7f0f188cd174..b653c2c80e8e8524ea6d7625c6a86f82 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 7a5110efc5af1be6644b7afecd6ac025c20e6794..3cb5685a97f67d759537fc92bb4cb376bb2905a7 100644 +index 7a5110efc5af1be6644b7afecd6ac025c20e6794..b79f29ccd512ec7d2a8f6a885c1a96dfd58e7dc5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -843,6 +843,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -5163,7 +5163,26 @@ index 7a5110efc5af1be6644b7afecd6ac025c20e6794..3cb5685a97f67d759537fc92bb4cb376 @Override public String getDisplayName() { return CraftChatMessage.fromComponent(this.displayName); -@@ -892,6 +904,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -873,6 +885,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + return this.itemName != null; + } + ++ // Paper start - Adventure ++ @Override ++ public net.kyori.adventure.text.Component itemName() { ++ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.itemName); ++ } ++ ++ @Override ++ public void itemName(final net.kyori.adventure.text.Component name) { ++ this.itemName = io.papermc.paper.adventure.PaperAdventure.asVanilla(name); ++ } ++ // Paper end - Adventure ++ + @Override + public String getLocalizedName() { + return this.getDisplayName(); +@@ -892,6 +916,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return this.lore != null && !this.lore.isEmpty(); } diff --git a/patches/server/0027-Support-components-in-ItemMeta.patch b/patches/server/0027-Support-components-in-ItemMeta.patch index 55ba44e2da..8164a26fa7 100644 --- a/patches/server/0027-Support-components-in-ItemMeta.patch +++ b/patches/server/0027-Support-components-in-ItemMeta.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Support components in ItemMeta diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3ea16b831 100644 +index 780b7e971a9d4fda1a9c78790c7969a0799f51ab..e663c996146986bc02efb05b4fb452913e4015d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -860,11 +860,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -32,7 +32,7 @@ index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3 @Override public boolean hasDisplayName() { return this.displayName != null; -@@ -1026,6 +1038,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1038,6 +1050,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return this.lore == null ? null : new ArrayList(Lists.transform(this.lore, CraftChatMessage::fromComponent)); } @@ -47,7 +47,7 @@ index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3 @Override public void setLore(List lore) { if (lore == null || lore.isEmpty()) { -@@ -1040,6 +1060,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1052,6 +1072,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } @@ -69,7 +69,7 @@ index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3 @Override public boolean hasCustomModelData() { return this.customModelData != null; -@@ -1663,6 +1698,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1675,6 +1710,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } for (Object object : addFrom) { diff --git a/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch b/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch index 53759073e9..17f9ccc1d9 100644 --- a/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch @@ -150,7 +150,7 @@ index b6521462d193bff83ace1dc694c6d957a7173969..d302767e8f01fdfcba9c22e2e35677af static Map getEnchantments(net.minecraft.world.item.ItemStack item) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba320632df9 100644 +index e663c996146986bc02efb05b4fb452913e4015d7..954aa31f5890deacbf2004aed8722360a87da7f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList; @@ -222,7 +222,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3 for (Map.Entry entry : ench.entrySet()) { // Doctor older enchants String enchantKey = entry.getKey().toString(); -@@ -951,14 +954,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -963,14 +966,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public Map getEnchants() { @@ -239,7 +239,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3 } if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { -@@ -1494,7 +1497,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1506,7 +1509,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { clone.customModelData = this.customModelData; clone.blockData = this.blockData; if (this.enchantments != null) { @@ -248,7 +248,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3 } if (this.hasAttributeModifiers()) { clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); -@@ -1814,4 +1817,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1826,4 +1829,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return (result != null) ? result : Optional.empty(); } diff --git a/patches/server/0936-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch b/patches/server/0936-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch index 7433f5486a..3541a8efc4 100644 --- a/patches/server/0936-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch +++ b/patches/server/0936-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix CraftMetaItem#getAttributeModifier duplication check diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 069666c797c39b5119e41a3c18727f89fcc3b8c5..fac6f3aa00b209e6090f4cb0207e53a994e51cac 100644 +index 796f7e5ce2661339081214369497318fb32d2743..f24f911bed23016e9e8d17c777481b7af45a5400 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1255,7 +1255,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1267,7 +1267,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null"); this.checkAttributeList(); for (Map.Entry entry : this.attributeModifiers.entries()) { diff --git a/patches/server/1034-Deep-clone-nbt-tags-in-PDC.patch b/patches/server/1034-Deep-clone-nbt-tags-in-PDC.patch index 1f567e6cdf..ee5dc2335c 100644 --- a/patches/server/1034-Deep-clone-nbt-tags-in-PDC.patch +++ b/patches/server/1034-Deep-clone-nbt-tags-in-PDC.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Deep clone nbt tags in PDC diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 7626ccaec65acbda22738296b4dd4423ee535aa8..ca41754a8224ad0fe959c982a4b6adfd8b346b05 100644 +index feea880d29ca7019bcdfa5232bea2b8ca8c3f644..2c4e7cfe71a9a960e7ac84b19ce32b478b9da3c3 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -284,7 +284,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -17,7 +17,7 @@ index 7626ccaec65acbda22738296b4dd4423ee535aa8..ca41754a8224ad0fe959c982a4b6adfd this.customTag = meta.customTag; -@@ -1511,7 +1511,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1523,7 +1523,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { if (this.customTag != null) { clone.customTag = this.customTag.copy(); } diff --git a/patches/server/1041-Fix-ItemFlags.patch b/patches/server/1041-Fix-ItemFlags.patch index d304c0b9cc..c72ef1a1d0 100644 --- a/patches/server/1041-Fix-ItemFlags.patch +++ b/patches/server/1041-Fix-ItemFlags.patch @@ -128,7 +128,7 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..04a0f63411ed95bcf5bac1689d29bbe5 } // Paper start -@@ -1455,6 +1497,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1467,6 +1509,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { && (this.hasFood() ? that.hasFood() && this.food.equals(that.food) : !that.hasFood()) && (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage()) && (this.hasMaxDamage() ? that.hasMaxDamage() && this.maxDamage.equals(that.maxDamage) : !that.hasMaxDamage()) @@ -137,7 +137,7 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..04a0f63411ed95bcf5bac1689d29bbe5 && (this.version == that.version); } -@@ -1497,6 +1541,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1509,6 +1553,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { hash = 61 * hash + (this.hasDamage() ? this.damage : 0); hash = 61 * hash + (this.hasMaxDamage() ? 1231 : 1237); hash = 61 * hash + (this.hasAttributeModifiers() ? this.attributeModifiers.hashCode() : 0); @@ -146,7 +146,7 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..04a0f63411ed95bcf5bac1689d29bbe5 hash = 61 * hash + this.version; return hash; } -@@ -1534,6 +1580,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1546,6 +1592,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { clone.damage = this.damage; clone.maxDamage = this.maxDamage; clone.version = this.version; @@ -161,7 +161,7 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..04a0f63411ed95bcf5bac1689d29bbe5 return clone; } catch (CloneNotSupportedException e) { throw new Error(e); -@@ -1643,6 +1697,16 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1655,6 +1709,16 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } @@ -178,7 +178,7 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..04a0f63411ed95bcf5bac1689d29bbe5 if (!this.unhandledTags.isEmpty()) { Tag unhandled = DataComponentPatch.CODEC.encodeStart(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), this.unhandledTags.build()).getOrThrow(IllegalStateException::new); try { -@@ -1653,6 +1717,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1665,6 +1729,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { Logger.getLogger(CraftMetaItem.class.getName()).log(Level.SEVERE, null, ex); } } @@ -193,7 +193,7 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..04a0f63411ed95bcf5bac1689d29bbe5 if (!this.persistentDataContainer.isEmpty()) { // Store custom tags, wrapped in their compound builder.put(CraftMetaItem.BUKKIT_CUSTOM_TAG.BUKKIT, this.persistentDataContainer.serialize()); -@@ -1794,6 +1866,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1806,6 +1878,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { CraftMetaItem.MAX_DAMAGE.TYPE, CraftMetaItem.CUSTOM_DATA.TYPE, CraftMetaItem.ATTRIBUTES.TYPE, diff --git a/patches/server/1044-improve-checking-handled-tags-in-itemmeta.patch b/patches/server/1044-improve-checking-handled-tags-in-itemmeta.patch index f946a3afd5..bef86d842e 100644 --- a/patches/server/1044-improve-checking-handled-tags-in-itemmeta.patch +++ b/patches/server/1044-improve-checking-handled-tags-in-itemmeta.patch @@ -404,7 +404,7 @@ index b444bd26d6c3def3494d3cc0520e462408272be3..8e0dd4b7a7a25a8beb27b507047bc48d getOrEmpty(tag, CraftMetaFirework.FIREWORKS).ifPresent((fireworks) -> { this.power = fireworks.flightDuration(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 9cd528a70ef3e6053a7103a6f9df5e93bb8550a4..8973a08f39279415e28a4fadf0015f1ab9581350 100644 +index f41ce4d2184aeb3c6b852d28073bb7ae265d03c3..7c5f9c711c2364ec3a47aed1203df370ed85a3c8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -308,7 +308,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -436,7 +436,7 @@ index 9cd528a70ef3e6053a7103a6f9df5e93bb8550a4..8973a08f39279415e28a4fadf0015f1a key.getValue().ifPresentOrElse((value) -> { this.unhandledTags.set((DataComponentType) key.getKey(), value); }, () -> { -@@ -1843,63 +1850,73 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1855,63 +1862,73 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.version = version; } diff --git a/patches/server/1045-General-ItemMeta-fixes.patch b/patches/server/1045-General-ItemMeta-fixes.patch index 431872ab6c..bd240b1527 100644 --- a/patches/server/1045-General-ItemMeta-fixes.patch +++ b/patches/server/1045-General-ItemMeta-fixes.patch @@ -159,7 +159,7 @@ index 8e0dd4b7a7a25a8beb27b507047bc48d8227627c..cf5d27ccc2225bac3aa57912f444f95d @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 651871b4fc512747bdfa6166c2d21b4f174f5cee..ba7d2b48552b36c6519724893e4054277e7a0cdc 100644 +index 7765f774bfdbead492ad6427873b8bc94ef64a4b..c2517ad00b6efba47e792a46e591038d79cb3a82 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -165,9 +165,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -174,7 +174,7 @@ index 651871b4fc512747bdfa6166c2d21b4f174f5cee..ba7d2b48552b36c6519724893e405427 Applicator put(ItemMetaKeyType key, T value) { this.builder.set(key.TYPE, value); -@@ -991,6 +992,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1003,6 +1004,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public void lore(final List lore) { @@ -182,7 +182,7 @@ index 651871b4fc512747bdfa6166c2d21b4f174f5cee..ba7d2b48552b36c6519724893e405427 this.lore = lore != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(lore) : null; } // Paper end -@@ -1115,6 +1117,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1127,6 +1129,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { // Paper end @Override public void setLore(List lore) { @@ -190,7 +190,7 @@ index 651871b4fc512747bdfa6166c2d21b4f174f5cee..ba7d2b48552b36c6519724893e405427 if (lore == null || lore.isEmpty()) { this.lore = null; } else { -@@ -1130,6 +1133,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1142,6 +1145,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { // Paper start @Override public void setLoreComponents(List lore) { @@ -198,7 +198,7 @@ index 651871b4fc512747bdfa6166c2d21b4f174f5cee..ba7d2b48552b36c6519724893e405427 if (lore == null) { this.lore = null; } else { -@@ -1397,7 +1401,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1409,7 +1413,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public String getAsString() {