mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 04:02:06 -07:00
Add EntityEffectTickEvent (#11838)
This commit is contained in:
@@ -9,8 +9,11 @@
|
||||
} else {
|
||||
entity.hurtServer(level, entity.damageSources().magic(), 6 << amplifier);
|
||||
}
|
||||
@@ -30,7 +_,7 @@
|
||||
@@ -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);
|
||||
|
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/effect/MobEffect.java
|
||||
+++ b/net/minecraft/world/effect/MobEffect.java
|
||||
@@ -76,6 +_,7 @@
|
||||
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
|
||||
this.applyEffectTick(level, entity, amplifier);
|
||||
}
|
||||
|
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/effect/MobEffectInstance.java
|
||||
+++ b/net/minecraft/world/effect/MobEffectInstance.java
|
||||
@@ -216,6 +_,7 @@
|
||||
int i = this.isInfiniteDuration() ? entity.tickCount : this.duration;
|
||||
if (entity.level() instanceof ServerLevel serverLevel
|
||||
&& this.effect.value().shouldApplyEffectTickThisTick(i, this.amplifier)
|
||||
+ && new io.papermc.paper.event.entity.EntityEffectTickEvent(entity.getBukkitLivingEntity(), org.bukkit.craftbukkit.potion.CraftPotionEffectType.minecraftHolderToBukkit(this.effect), this.amplifier).callEvent() // Paper - Add EntityEffectTickEvent
|
||||
&& !this.effect.value().applyEffectTick(serverLevel, entity, this.amplifier)) {
|
||||
entity.removeEffect(this.effect);
|
||||
}
|
Reference in New Issue
Block a user