PaperMC/paper-server/patches/sources/net/minecraft/world/effect/MobEffectUtil.java.patch
CraftBukkit/Spigot 30e4583dbe Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
2024-12-11 22:26:55 +01:00

26 lines
2 KiB
Diff

--- a/net/minecraft/world/effect/MobEffectUtil.java
+++ b/net/minecraft/world/effect/MobEffectUtil.java
@@ -50,13 +50,19 @@
}
public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel world, @Nullable Entity entity, Vec3 origin, double range, MobEffectInstance statusEffectInstance, int duration) {
- Holder<MobEffect> holder = statusEffectInstance.getEffect();
- List<ServerPlayer> list = world.getPlayers((entityplayer) -> {
- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && origin.closerThan(entityplayer.position(), range) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < statusEffectInstance.getAmplifier() || entityplayer.getEffect(holder).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) {
+ // CraftBukkit end
+ Holder<MobEffect> holder = mobeffect.getEffect();
+ List<ServerPlayer> list = worldserver.getPlayers((entityplayer) -> {
+ return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1));
});
list.forEach((entityplayer) -> {
- entityplayer.addEffect(new MobEffectInstance(statusEffectInstance), entity);
+ entityplayer.addEffect(new MobEffectInstance(mobeffect), entity, cause); // CraftBukkit
});
return list;
}