Improve item default attribute API

This commit is contained in:
Jake Potrebic
2021-05-08 15:01:54 -07:00
parent eb675d9110
commit c2b061d759
3 changed files with 29 additions and 8 deletions

View File

@@ -386,7 +386,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {
return material.getDefaultAttributeModifiers(slot);
// Paper start - delegate to method on ItemType
final org.bukkit.inventory.ItemType item = material.asItemType();
Preconditions.checkArgument(item != null, material + " is not an item and does not have default attributes");
return item.getDefaultAttributeModifiers(slot);
// Paper end - delegate to method on ItemType
}
@Override