aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-05-22 07:16:50 -0700
committerJake Potrebic <[email protected]>2024-05-22 07:16:50 -0700
commitd3ffa62b7f2f2c3b067e1900c7e567b6a1cea623 (patch)
treefe65986a26bc6e9a738b4bc0f04de7866fb49827
parent980cff9f298032f8670b20368851b8a7316a44d7 (diff)
downloadPaper-d3ffa62b7f2f2c3b067e1900c7e567b6a1cea623.tar.gz
Paper-d3ffa62b7f2f2c3b067e1900c7e567b6a1cea623.zip
fix default item attributes
-rw-r--r--patches/server/0551-Fix-item-default-attributes-API.patch18
1 files changed, 18 insertions, 0 deletions
diff --git a/patches/server/0551-Fix-item-default-attributes-API.patch b/patches/server/0551-Fix-item-default-attributes-API.patch
index 7bc3c4f579..b273334b02 100644
--- a/patches/server/0551-Fix-item-default-attributes-API.patch
+++ b/patches/server/0551-Fix-item-default-attributes-API.patch
@@ -5,6 +5,24 @@ Subject: [PATCH] Fix item default attributes API
(previously added this API but upstream also added it)
+diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
+index f5bb5802aae64773252c9399df0fbe9de3d1d121..566ac7873eb1bd39479e9d1404e124af235b6fcb 100644
+--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
+@@ -189,9 +189,10 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
+
+ @Override
+ public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot slot) {
+- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
+-
+- ItemAttributeModifiers nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
++ // Paper start - fix item default attribute API
++ final ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
++ ItemAttributeModifiers nmsDefaultAttributes = this.item.components().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
++ // Paper end - fix item default attribute API
+ nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
+ Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
+ defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 952a8147947fa0e2a960628fc760212d3d206ce6..27acc1965e16d697fa98f64cf64ecc6ecd775e86 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java