aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0287-Attributes-API-for-item-defaults.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/api/0287-Attributes-API-for-item-defaults.patch')
-rw-r--r--patches/api/0287-Attributes-API-for-item-defaults.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/patches/api/0287-Attributes-API-for-item-defaults.patch b/patches/api/0287-Attributes-API-for-item-defaults.patch
new file mode 100644
index 0000000000..66172a6027
--- /dev/null
+++ b/patches/api/0287-Attributes-API-for-item-defaults.patch
@@ -0,0 +1,55 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Sat, 8 May 2021 15:02:00 -0700
+Subject: [PATCH] Attributes API for item defaults
+
+
+diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
+index 8fd928cfe61ab6f06c52eb5e4561fd6860e1f8d9..64ca3c676703eed55b4ac8a2d4561d483c6935b1 100644
+--- a/src/main/java/org/bukkit/Material.java
++++ b/src/main/java/org/bukkit/Material.java
+@@ -4720,6 +4720,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
+ public io.papermc.paper.inventory.ItemRarity getItemRarity() {
+ return Bukkit.getUnsafe().getItemRarity(this);
+ }
++
++ /**
++ * Returns an immutable multimap of attributes for the slot.
++ * {@link #isItem()} must be true for this material.
++ *
++ * @param equipmentSlot the slot to get the attributes for
++ * @throws IllegalArgumentException if {@link #isItem()} is false
++ * @return an immutable multimap of attributes
++ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)}
++ */
++ @NotNull
++ @Deprecated
++ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
++ return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot);
++ }
+ // Paper end
+
+ /**
+diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
+index d9e3e4ad108a94ac6f0f5378d22d47845091efb4..bdee63fb97cbc0c9fbe7df74de5cb5f4ed7de3ca 100644
+--- a/src/main/java/org/bukkit/UnsafeValues.java
++++ b/src/main/java/org/bukkit/UnsafeValues.java
+@@ -195,6 +195,18 @@ public interface UnsafeValues {
+ */
+ public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial);
+
++ /**
++ * Returns an immutable multimap of attributes for the material and slot.
++ * {@link Material#isItem()} must be true for this material.
++ *
++ * @param material the material
++ * @param equipmentSlot the slot to get the attributes for
++ * @throws IllegalArgumentException if {@link Material#isItem()} is false
++ * @return an immutable multimap of attributes
++ */
++ @org.jetbrains.annotations.NotNull
++ public Multimap<Attribute, AttributeModifier> getItemAttributes(@org.jetbrains.annotations.NotNull Material material, @org.jetbrains.annotations.NotNull EquipmentSlot equipmentSlot);
++
+ /**
+ * Returns the server's protocol version.
+ *