--- a/net/minecraft/world/effect/MobEffectUtil.java
+++ b/net/minecraft/world/effect/MobEffectUtil.java
@@ -12,11 +12,15 @@
 import net.minecraft.world.phys.Vec3;
 
 public final class MobEffectUtil {
+
+    public MobEffectUtil() {}
+
     public static Component formatDuration(MobEffectInstance effect, float multiplier) {
         if (effect.isInfiniteDuration()) {
             return Component.translatable("effect.duration.infinite");
         } else {
-            int i = Mth.floor((float)effect.getDuration() * multiplier);
+            int i = Mth.floor((float) effect.getDuration() * multiplier);
+
             return Component.literal(StringUtil.formatTickDuration(i));
         }
     }
@@ -28,6 +32,7 @@
     public static int getDigSpeedAmplification(LivingEntity entity) {
         int i = 0;
         int j = 0;
+
         if (entity.hasEffect(MobEffects.DIG_SPEED)) {
             i = entity.getEffect(MobEffects.DIG_SPEED).getAmplifier();
         }
@@ -44,12 +49,32 @@
     }
 
     public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel world, @Nullable Entity entity, Vec3 origin, double range, MobEffectInstance statusEffectInstance, int duration) {
-        MobEffect mobEffect = statusEffectInstance.getEffect();
-        List<ServerPlayer> list = world.getPlayers((player) -> {
-            return player.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo(player)) && origin.closerThan(player.position(), range) && (!player.hasEffect(mobEffect) || player.getEffect(mobEffect).getAmplifier() < statusEffectInstance.getAmplifier() || player.getEffect(mobEffect).endsWithin(duration - 1));
+        // CraftBukkit start
+        return MobEffectUtil.addEffectToPlayersAround(world, entity, origin, range, statusEffectInstance, duration, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
+    }
+
+    public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) {
+        // Paper start
+        return addEffectToPlayersAround(worldserver, entity, vec3d, d0, mobeffect, i, cause, null);
+    }
+
+    public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause, @Nullable java.util.function.Predicate<ServerPlayer> playerPredicate) {
+        // Paper end
+        // CraftBukkit end
+        MobEffect mobeffectlist = mobeffect.getEffect();
+        List<ServerPlayer> list = worldserver.getPlayers((entityplayer) -> {
+            // Paper start
+            boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
+            if (condition) {
+                return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true
+            } else {
+                return false;
+            }
+            // Paper ned
         });
-        list.forEach((player) -> {
-            player.addEffect(new MobEffectInstance(statusEffectInstance), entity);
+
+        list.forEach((entityplayer) -> {
+            entityplayer.addEffect(new MobEffectInstance(mobeffect), entity, cause); // CraftBukkit
         });
         return list;
     }
