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 653f0432b5
commit bab31b6f55
No known key found for this signature in database
GPG key ID: 27F6CCCF55D2EE62
12 changed files with 57 additions and 48 deletions

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 6344ab27c113dd42c729e0b05b957670c4930722..bf58fb8acd09723cbc55f6ac41c24cccda97bac8 100644
index a4c6fd2f6066ecc4a36a423cb2980ec60d9c7ec1..f3ec9ae17355abf430ebb781b9acd9f529d88a11 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -561,8 +561,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {