mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 07:39:16 +01:00
55 lines
2.6 KiB
Diff
55 lines
2.6 KiB
Diff
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
|
|
index d187038a0ad2f4c73484c0b494ba58373adfe743..663d2ce14030a54b83c7e9aebad48f8fd6c41b69 100644
|
|
--- a/src/main/java/org/bukkit/Material.java
|
|
+++ b/src/main/java/org/bukkit/Material.java
|
|
@@ -4016,6 +4016,21 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata
|
|
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 c1bda4dba319999261613d4aa45a280ed1af0d8c..153ceeb45fc331ca27e0646bc63626e2ea779624 100644
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
@@ -172,6 +172,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.
|
|
*
|