Update Enchantment damage increase API

The Enchantment damage increase API added previously used the
EntityCategory enum as a parameter. These values are now however
determined by tags instead of the categories themselves.

Deprecated the outdated api method, create a new overload that takes
EntityType instead and implement deprecated method by guessing an entity
type from the builtin registry based on the category passed.
This method allows
a) the tags to still be modified and the legacy
   method still respecting such.
b) potential cursed implementations of enchantments of plugins to not
   break that override the getDamageBonus method on Enchantment.
This commit is contained in:
Bjarne Koll
2024-04-25 18:42:50 +02:00
parent dc556091df
commit b7e5de9401
3 changed files with 39 additions and 30 deletions

View File

@@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category");
throw new UnsupportedOperationException("Cannot set the hurt direction on a non player");
}
// Paper end - more enchant API
// Paper end - hurt direction API
+
+ // Paper start - knockback API
+ @Override