Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
} else {
entity.hurtServer(level, entity.damageSources().magic(), 6 << amplifier);
}
@@ -28,9 +_,10 @@
@@ -28,11 +_,12 @@
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);
- int i = (int)(health * (4 << amplifier) + 0.5);
- entity.heal(i);
+ int i = Math.max((int)(health * (4 << amplifier) + 0.5), 0); // Paper - avoid negative values for MC-266229
+ entity.heal(i, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
} else {
int i = (int)(health * (6 << amplifier) + 0.5);
- int i = (int)(health * (6 << amplifier) + 0.5);
+ int i = Math.max((int)(health * (6 << amplifier) + 0.5), 0); // Paper - avoid negative values for MC-266229
if (source == null) {
entity.hurtServer(level, entity.damageSources().magic(), i);
} else {
Loading