From 0c9dd451de24c0ad0e2fcef8d48faab42a4e8cad Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 22 May 2024 07:16:50 -0700 Subject: [PATCH] fix default item attributes --- .../Fix-item-default-attributes-API.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/patches/server/Fix-item-default-attributes-API.patch b/patches/server/Fix-item-default-attributes-API.patch index 94cd302132..6a2da937f4 100644 --- a/patches/server/Fix-item-default-attributes-API.patch +++ b/patches/server/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java +@@ -0,0 +0,0 @@ public class CraftItemType implements ItemType.Typed, Han + + @Override + public Multimap getDefaultAttributeModifiers(EquipmentSlot slot) { +- ImmutableMultimap.Builder defaultAttributes = ImmutableMultimap.builder(); +- +- ItemAttributeModifiers nmsDefaultAttributes = this.item.getDefaultAttributeModifiers(); ++ // Paper start - fix item default attribute API ++ final ImmutableMultimap.Builder 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java