Add even more Enchantment API (#11115)

This commit is contained in:
Jake Potrebic
2024-08-17 13:58:36 -07:00
parent 0a041c951d
commit 0df31bdeb3
5 changed files with 154 additions and 26 deletions

View File

@@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve
* @return the name of the enchantment with {@code level} applied
*/
public abstract net.kyori.adventure.text.@NotNull Component displayName(int level);
+
// Paper end
+ // Paper start - more Enchantment API
+ /**
+ * Checks if this enchantment can be found in villager trades.
+ *
@@ -129,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return the damage increase
+ * @deprecated Enchantments now have a complex effect systems that cannot be reduced to a simple damage increase.
+ */
+ @Contract("-> fail")
+ @Contract("_, _ -> fail")
+ @Deprecated(forRemoval = true, since = "1.20.5")
+ public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory);
+
@@ -141,7 +141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return the damage increase
+ * @deprecated Enchantments now have a complex effect systems that cannot be reduced to a simple damage increase.
+ */
+ @Contract("-> fail")
+ @Contract("_, _ -> fail")
+ @Deprecated(forRemoval = true, since = "1.21")
+ public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityType entityType);
+
@@ -170,9 +170,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public abstract java.util.Set<org.bukkit.inventory.EquipmentSlotGroup> getActiveSlotGroups();
// Paper end
+ // Paper end - more Enchantment API
+
// Paper start - mark translation key as deprecated
/**
* @deprecated this method assumes that the enchantments description
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java