0
0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-31 12:01:22 +00:00
Paper/paper-server/patches/sources/net/minecraft/world/effect/HealOrHarmMobEffect.java.patch
2025-01-12 17:50:22 +01:00

24 lines
1.4 KiB
Diff

--- a/net/minecraft/world/effect/HealOrHarmMobEffect.java
+++ b/net/minecraft/world/effect/HealOrHarmMobEffect.java
@@ -16,7 +_,7 @@
@Override
public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) {
if (this.isHarm == entity.isInvertedHealAndHarm()) {
- entity.heal(Math.max(4 << amplifier, 0));
+ entity.heal(Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
} else {
entity.hurtServer(level, entity.damageSources().magic(), 6 << amplifier);
}
@@ -28,9 +_,10 @@
public void applyInstantenousEffect(
ServerLevel level, @Nullable Entity source, @Nullable Entity indirectSource, LivingEntity entity, int amplifier, double health
) {
+ if (!new io.papermc.paper.event.entity.EntityEffectTickEvent(entity.getBukkitLivingEntity(), org.bukkit.craftbukkit.potion.CraftPotionEffectType.minecraftToBukkit(this), amplifier).callEvent()) { return; } // Paper - Add EntityEffectTickEvent
if (this.isHarm == entity.isInvertedHealAndHarm()) {
int i = (int)(health * (4 << amplifier) + 0.5);
- entity.heal(i);
+ entity.heal(i, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
} else {
int i = (int)(health * (6 << amplifier) + 0.5);
if (source == null) {