mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
54 lines
2.6 KiB
Diff
54 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 9b1c9e60dba9ea3ef8d8e164f13dd76daf57db8e..e2b3470e3c9a97671723f5a67f722fb86fb07fbf 100644
|
||
|
--- a/src/main/java/org/bukkit/Material.java
|
||
|
+++ b/src/main/java/org/bukkit/Material.java
|
||
|
@@ -3600,6 +3600,19 @@ public enum Material implements Keyed {
|
||
|
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
|
||
|
+ */
|
||
|
+ @NotNull
|
||
|
+ public com.google.common.collect.Multimap<org.bukkit.attribute.Attribute, org.bukkit.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 e504567cf755557be8511f2c93c171572b78e722..379acee1b5f2d06e6a96f3444783f4a29ca24095 100644
|
||
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||
|
@@ -165,6 +165,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 com.google.common.collect.Multimap<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getItemAttributes(@org.jetbrains.annotations.NotNull Material material, @org.jetbrains.annotations.NotNull org.bukkit.inventory.EquipmentSlot equipmentSlot);
|
||
|
+
|
||
|
/**
|
||
|
* Returns the server's protocol version.
|
||
|
*
|