aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch')
-rw-r--r--paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch b/paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch
new file mode 100644
index 0000000000..6c259deb9b
--- /dev/null
+++ b/paper-server/patches/unapplied/net/minecraft/world/effect/MobEffectUtil.java.patch
@@ -0,0 +1,39 @@
+--- a/net/minecraft/world/effect/MobEffectUtil.java
++++ b/net/minecraft/world/effect/MobEffectUtil.java
+@@ -50,13 +50,32 @@
+ }
+
+ 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) {
++ // Paper start - Add ElderGuardianAppearanceEvent
++ 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 - Add ElderGuardianAppearanceEvent
++ // CraftBukkit end
++ Holder<MobEffect> holder = mobeffect.getEffect();
++ List<ServerPlayer> list = worldserver.getPlayers((entityplayer) -> {
++ // Paper start - Add ElderGuardianAppearanceEvent
++ boolean condition = 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));
++ if (condition) {
++ return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true
++ } else {
++ return false;
++ }
++ // Paper ned - Add ElderGuardianAppearanceEvent
+ });
+
+ list.forEach((entityplayer) -> {
+- entityplayer.addEffect(new MobEffectInstance(statusEffectInstance), entity);
++ entityplayer.addEffect(new MobEffectInstance(mobeffect), entity, cause); // CraftBukkit
+ });
+ return list;
+ }