diff options
author | TotalledZebra <[email protected]> | 2024-05-30 23:31:45 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-30 22:31:45 +0200 |
commit | 3181470ad7d372d2a799c3dcdb61e9392969abe4 (patch) | |
tree | 2c14a8d935b793dd89b1657fb48480b70e62d8c5 /patches | |
parent | a47e11d464d84aca537687748aafe32c08567801 (diff) | |
download | Paper-3181470ad7d372d2a799c3dcdb61e9392969abe4.tar.gz Paper-3181470ad7d372d2a799c3dcdb61e9392969abe4.zip |
Add entity heal API (#10267)
Diffstat (limited to 'patches')
11 files changed, 87 insertions, 23 deletions
diff --git a/patches/api/0292-Missing-Entity-API.patch b/patches/api/0292-Missing-Entity-API.patch index 4dcfc5d27a..93a60e9366 100644 --- a/patches/api/0292-Missing-Entity-API.patch +++ b/patches/api/0292-Missing-Entity-API.patch @@ -12,6 +12,7 @@ Co-authored-by: Amin <[email protected]> Co-authored-by: TrollyLoki <[email protected]> Co-authored-by: FireInstall <[email protected]> Co-authored-by: maxcom1 <[email protected]> +Co-authored-by: TotalledZebra <[email protected]> diff --git a/src/main/java/io/papermc/paper/entity/SchoolableFish.java b/src/main/java/io/papermc/paper/entity/SchoolableFish.java new file mode 100644 @@ -348,6 +349,36 @@ index 191ce6c0e32ab3d05b1376e0fa56d1292c2d442c..8de09075e14a08a6c68f9c24e8960cc0 */ -public interface Cod extends Fish { } +public interface Cod extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API +diff --git a/src/main/java/org/bukkit/entity/Damageable.java b/src/main/java/org/bukkit/entity/Damageable.java +index c4537080ee1875e984356eee42337a1342f4c9a3..f89edd9c129802f70eac022ff6bf80bef378f5e8 100644 +--- a/src/main/java/org/bukkit/entity/Damageable.java ++++ b/src/main/java/org/bukkit/entity/Damageable.java +@@ -53,6 +53,25 @@ public interface Damageable extends Entity { + */ + void setHealth(double health); + ++ // Paper start - entity heal API ++ /** ++ * Heal this entity by the given amount. This will call {@link org.bukkit.event.entity.EntityRegainHealthEvent}. ++ * ++ * @param amount heal amount ++ */ ++ default void heal(final double amount) { ++ this.heal(amount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.CUSTOM); ++ } ++ ++ /** ++ * Heal this entity by the given amount. This will call {@link org.bukkit.event.entity.EntityRegainHealthEvent}. ++ * ++ * @param amount heal amount ++ * @param reason heal reason ++ */ ++ void heal(double amount, @NotNull org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason); ++ // Paper end - entity heal API ++ + /** + * Gets the entity's absorption amount. + * diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java index 58191017244f3949f6174fb108e3a245738a53c4..61672c6faf94aa497145aadd634bb10103c7b05a 100644 --- a/src/main/java/org/bukkit/entity/Enderman.java diff --git a/patches/server/0569-Missing-Entity-API.patch b/patches/server/0569-Missing-Entity-API.patch index 1f27707e2d..9d9cf655c9 100644 --- a/patches/server/0569-Missing-Entity-API.patch +++ b/patches/server/0569-Missing-Entity-API.patch @@ -42,6 +42,7 @@ Co-authored-by: Amin <[email protected]> Co-authored-by: TrollyLoki <[email protected]> Co-authored-by: FireInstall <[email protected]> Co-authored-by: maxcom1 <[email protected]> +Co-authored-by: TotalledZebra <[email protected]> diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java index 55e85267c7cbd8be5d2da212e33c43fb353f2e12..c72d6bccf7d72d08d388c65936a89c92261c7860 100644 @@ -632,6 +633,24 @@ index af432f9a1d255a56c31c3b97aeb4457d17f37e3e..f93f8f6509b12eb9b1e07c829278bb08 + } + // Paper end - Missing Dolphin API } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java +index cc4194ac9d7501b5d15655674dade14d59cb6733..33ae03b78b01c005a291a343b42507fb539e81a6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java +@@ -51,6 +51,13 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago + this.getParent().setHealth(health); + } + ++ // Paper start - entity heal API ++ @Override ++ public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) { ++ this.getParent().heal(amount, reason); ++ } ++ // Paper end - entity heal API ++ + @Override + public double getAbsorptionAmount() { + return this.getParent().getAbsorptionAmount(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java index 21dc209e6f98b6306833b41e2763e746047d5a94..983b9d6ddb58eff297e96e5c8b28ec427efa267d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java @@ -829,10 +848,24 @@ index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad926 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 1cfc3d18fb785410f5acfcf3c338776858efe25a..ea929ca51bd35447da4bdb42379dfc12ea2aae67 100644 +index 1cfc3d18fb785410f5acfcf3c338776858efe25a..e549c827d68ca96afea1ffdabf6802275c3328d1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -906,14 +906,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -122,6 +122,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + } + } + ++ // Paper start - entity heal API ++ @Override ++ public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) { ++ this.getHandle().heal((float) amount, reason); ++ } ++ // Paper end - entity heal API ++ + @Override + public double getAbsorptionAmount() { + return this.getHandle().getAbsorptionAmount(); +@@ -906,14 +913,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public boolean isInvisible() { diff --git a/patches/server/0579-Stinger-API.patch b/patches/server/0579-Stinger-API.patch index 3abe3d922a..fe0a993d6a 100644 --- a/patches/server/0579-Stinger-API.patch +++ b/patches/server/0579-Stinger-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Stinger API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index ea929ca51bd35447da4bdb42379dfc12ea2aae67..f0e9d68381fb75900bcd6976a83fd94028fd2712 100644 +index e549c827d68ca96afea1ffdabf6802275c3328d1..f4574527cb1dddb97dba1fa2dfe1c17b89728015 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -353,6 +353,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -360,6 +360,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } // Paper end } @@ -20,7 +20,7 @@ index ea929ca51bd35447da4bdb42379dfc12ea2aae67..f0e9d68381fb75900bcd6976a83fd940 // Paper start - Add methods for working with arrows stuck in living entities @Override -@@ -367,6 +372,34 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -374,6 +379,34 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } // Paper end - Add methods for working with arrows stuck in living entities diff --git a/patches/server/0611-Improve-and-expand-AsyncCatcher.patch b/patches/server/0611-Improve-and-expand-AsyncCatcher.patch index 3fa3ba5e71..5cc500bcf5 100644 --- a/patches/server/0611-Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/0611-Improve-and-expand-AsyncCatcher.patch @@ -202,10 +202,10 @@ index 5f6cec79745aa8e5ae3aa8139c93bbdd1c36c6d5..1bf9fbc8f39ec4b0dd1369cace6bbd34 ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(new ResourceLocation(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index f0e9d68381fb75900bcd6976a83fd94028fd2712..a4c6fd2f6066ecc4a36a423cb2980ec60d9c7ec1 100644 +index f4574527cb1dddb97dba1fa2dfe1c17b89728015..00cac0c83897221fd4a83dcee884db751321af2e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -516,6 +516,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -523,6 +523,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public boolean addPotionEffect(PotionEffect effect, boolean force) { diff --git a/patches/server/0691-More-Projectile-API.patch b/patches/server/0691-More-Projectile-API.patch index a70deb02fb..4db060784d 100644 --- a/patches/server/0691-More-Projectile-API.patch +++ b/patches/server/0691-More-Projectile-API.patch @@ -425,10 +425,10 @@ index 6e2f91423371ead9890095cf4b1e2299c4dcba28..9d8f4b7176e60180565e3134a14ecf19 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a4c6fd2f6066ecc4a36a423cb2980ec60d9c7ec1..382b4f0854284a561325dde141000434a9ddd885 100644 +index 00cac0c83897221fd4a83dcee884db751321af2e..88cd49128a19efee6bf20dcfdcfda4b9bd5e4808 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -640,7 +640,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -647,7 +647,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } else if (Firework.class.isAssignableFrom(projectile)) { Location location = this.getEyeLocation(); @@ -607,7 +607,7 @@ index e374b9f40eddca13b30855d25a2030f8df98138f..4fc893378fb0568ddcffc7593d66df6b // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index c00667c0a27f96202439f45bddd2b79cd46e7c25..b8bb8887646076ad5724dd5558f5f819a530b5fa 100644 +index 59d444a79b5852dabc082b56bafe71d79e42541f..fa50860c8bb34c914096a2af17be62277b698c1a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -832,19 +832,19 @@ public class CraftEventFactory { diff --git a/patches/server/0756-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/server/0756-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index 23927dc5e5..53c7b6b86b 100644 --- a/patches/server/0756-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/server/0756-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,10 +5,10 @@ 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 382b4f0854284a561325dde141000434a9ddd885..eaeacf28295a5f1af37c8733f36066a69d858cc3 100644 +index 88cd49128a19efee6bf20dcfdcfda4b9bd5e4808..c761156e2b192ba26d608adc1a9366ff08f90ce3 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 { +@@ -568,8 +568,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } @Override @@ -25,7 +25,7 @@ index 382b4f0854284a561325dde141000434a9ddd885..eaeacf28295a5f1af37c8733f36066a6 Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation"); net.minecraft.world.level.Level world = ((CraftWorld) this.getWorld()).getHandle(); -@@ -649,6 +656,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -656,6 +663,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { if (velocity != null) { ((T) launch.getBukkitEntity()).setVelocity(velocity); } diff --git a/patches/server/0771-Add-entity-knockback-API.patch b/patches/server/0771-Add-entity-knockback-API.patch index 96fdca374b..7830165ce6 100644 --- a/patches/server/0771-Add-entity-knockback-API.patch +++ b/patches/server/0771-Add-entity-knockback-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add entity knockback API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index eaeacf28295a5f1af37c8733f36066a69d858cc3..bd2287ca5d47d5fa2cae95c43d7e4ea5d74cf39c 100644 +index c761156e2b192ba26d608adc1a9366ff08f90ce3..2537d4d4ec1243f3b80ec13a6b863ec6de619919 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -1088,4 +1088,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -1095,4 +1095,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { throw new UnsupportedOperationException("Cannot set the hurt direction on a non player"); } // Paper end - hurt direction API diff --git a/patches/server/0788-ItemStack-damage-API.patch b/patches/server/0788-ItemStack-damage-API.patch index fc693daf07..b6c586f282 100644 --- a/patches/server/0788-ItemStack-damage-API.patch +++ b/patches/server/0788-ItemStack-damage-API.patch @@ -11,10 +11,10 @@ the logic associated with damaging them public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index bd2287ca5d47d5fa2cae95c43d7e4ea5d74cf39c..350ec6c4af1dc8c559d5987d011049f14b85bd06 100644 +index 2537d4d4ec1243f3b80ec13a6b863ec6de619919..f866a3c2f5ec5954bab9de5f8d3e2a8c55824805 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -1096,4 +1096,48 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -1103,4 +1103,48 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { this.getHandle().knockback(strength, directionX, directionZ); }; // Paper end - knockback API diff --git a/patches/server/0789-Friction-API.patch b/patches/server/0789-Friction-API.patch index d0994709bc..65d28c7419 100644 --- a/patches/server/0789-Friction-API.patch +++ b/patches/server/0789-Friction-API.patch @@ -133,10 +133,10 @@ index 1a291dd8a287db30e71dcb315599fc4b038764c4..30d62ee4d5cd2ddacb8783b5bbbf475d public int getHealth() { return this.getHandle().health; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 350ec6c4af1dc8c559d5987d011049f14b85bd06..025cdeecfd26aed350bda6098714608b31c6d513 100644 +index f866a3c2f5ec5954bab9de5f8d3e2a8c55824805..8f987c87032fad49835d51cd747f40df2bb5aa32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -1140,4 +1140,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -1147,4 +1147,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { nmsStack.hurtAndBreak(amount, this.getHandle(), slot); } // Paper end - ItemStack damage API diff --git a/patches/server/0814-Add-Entity-Body-Yaw-API.patch b/patches/server/0814-Add-Entity-Body-Yaw-API.patch index d7a5c9f9a3..7e9aba16c7 100644 --- a/patches/server/0814-Add-Entity-Body-Yaw-API.patch +++ b/patches/server/0814-Add-Entity-Body-Yaw-API.patch @@ -43,10 +43,10 @@ index 365281dfc0308c5db0c72b56208d9b87be0e955e..991b94ff1186b1071a94b2662873dc07 @Override public boolean isInvisible() { // Paper - moved up from LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 025cdeecfd26aed350bda6098714608b31c6d513..c11b9afdf8d5f6f61aa2e07f6e5b78855bf5d8bd 100644 +index 8f987c87032fad49835d51cd747f40df2bb5aa32..a231543cf4fcc442e3675ece0d4c4950f4ed3126 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -1154,4 +1154,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -1161,4 +1161,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { this.getHandle().frictionState = state; } // Paper end - friction API diff --git a/patches/server/0846-Add-method-to-remove-all-active-potion-effects.patch b/patches/server/0846-Add-method-to-remove-all-active-potion-effects.patch index 1b923edd92..5ea4211d6a 100644 --- a/patches/server/0846-Add-method-to-remove-all-active-potion-effects.patch +++ b/patches/server/0846-Add-method-to-remove-all-active-potion-effects.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add method to remove all active potion effects diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index c11b9afdf8d5f6f61aa2e07f6e5b78855bf5d8bd..2d4e49f386be35ee8912c1bca38f74b8d8926f3a 100644 +index a231543cf4fcc442e3675ece0d4c4950f4ed3126..18af8736f30780b48313257a09973e30df6d0e2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -555,6 +555,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -562,6 +562,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return effects; } |