2021-06-11 12:02:28 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
2022-07-12 17:16:05 +00:00
index 4e6273c609630be7c196d4eed54fbca097eaf7d4..6eae173f589cb90eb6e41b5b75e13a3c02e7901d 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
2022-07-12 17:16:05 +00:00
@@ -4156,6 +4156,21 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata
2021-06-11 12:02:28 +00:00
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
2022-01-01 03:05:42 +00:00
+ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)}
2021-06-11 12:02:28 +00:00
+ */
+ @NotNull
2022-01-01 03:05:42 +00:00
+ @Deprecated
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
2021-06-11 12:02:28 +00:00
+ 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
2022-05-27 15:42:36 +00:00
index 248453b259781aa45516133a0ed824f4e6f6a369..a3045b63c4e63f8eac902beb0f48367a5e3e5d20 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
2022-05-27 15:42:36 +00:00
@@ -190,6 +190,18 @@ public interface UnsafeValues {
2021-06-11 12:02:28 +00:00
*/
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
2022-01-01 03:05:42 +00:00
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@org.jetbrains.annotations.NotNull Material material, @org.jetbrains.annotations.NotNull EquipmentSlot equipmentSlot);
2021-06-11 12:02:28 +00:00
+
/**
* Returns the server's protocol version.
*