diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch new file mode 100644 index 0000000000..cb9791d6f1 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/effect/MobEffectUtil.java.patch @@ -0,0 +1,74 @@ +--- a/net/minecraft/world/effect/MobEffectUtil.java ++++ b/net/minecraft/world/effect/MobEffectUtil.java +@@ -15,47 +15,53 @@ + + public MobEffectUtil() {} + +- public static Component formatDuration(MobEffectInstance mobeffectinstance, float f, float f1) { +- if (mobeffectinstance.isInfiniteDuration()) { ++ public static Component formatDuration(MobEffectInstance mobeffect, float f, float f1) { ++ if (mobeffect.isInfiniteDuration()) { + return Component.translatable("effect.duration.infinite"); + } else { +- int i = Mth.floor((float) mobeffectinstance.getDuration() * f); ++ int i = Mth.floor((float) mobeffect.getDuration() * f); + + return Component.literal(StringUtil.formatTickDuration(i, f1)); + } + } + +- public static boolean hasDigSpeed(LivingEntity livingentity) { +- return livingentity.hasEffect(MobEffects.DIG_SPEED) || livingentity.hasEffect(MobEffects.CONDUIT_POWER); ++ public static boolean hasDigSpeed(LivingEntity entity) { ++ return entity.hasEffect(MobEffects.DIG_SPEED) || entity.hasEffect(MobEffects.CONDUIT_POWER); + } + +- public static int getDigSpeedAmplification(LivingEntity livingentity) { ++ public static int getDigSpeedAmplification(LivingEntity entity) { + int i = 0; + int j = 0; + +- if (livingentity.hasEffect(MobEffects.DIG_SPEED)) { +- i = livingentity.getEffect(MobEffects.DIG_SPEED).getAmplifier(); ++ if (entity.hasEffect(MobEffects.DIG_SPEED)) { ++ i = entity.getEffect(MobEffects.DIG_SPEED).getAmplifier(); + } + +- if (livingentity.hasEffect(MobEffects.CONDUIT_POWER)) { +- j = livingentity.getEffect(MobEffects.CONDUIT_POWER).getAmplifier(); ++ if (entity.hasEffect(MobEffects.CONDUIT_POWER)) { ++ j = entity.getEffect(MobEffects.CONDUIT_POWER).getAmplifier(); + } + + return Math.max(i, j); + } + +- public static boolean hasWaterBreathing(LivingEntity livingentity) { +- return livingentity.hasEffect(MobEffects.WATER_BREATHING) || livingentity.hasEffect(MobEffects.CONDUIT_POWER); ++ public static boolean hasWaterBreathing(LivingEntity entity) { ++ return entity.hasEffect(MobEffects.WATER_BREATHING) || entity.hasEffect(MobEffects.CONDUIT_POWER); + } + +- public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel serverlevel, @Nullable Entity entity, Vec3 vec3, double d0, MobEffectInstance mobeffectinstance, int i) { +- MobEffect mobeffect = mobeffectinstance.getEffect(); +- List<ServerPlayer> list = serverlevel.getPlayers((serverplayer) -> { +- return serverplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) serverplayer)) && vec3.closerThan(serverplayer.position(), d0) && (!serverplayer.hasEffect(mobeffect) || serverplayer.getEffect(mobeffect).getAmplifier() < mobeffectinstance.getAmplifier() || serverplayer.getEffect(mobeffect).endsWithin(i - 1)); ++ public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel level, @Nullable Entity source, Vec3 pos, double radius, MobEffectInstance mobeffect, int effect) { ++ // CraftBukkit start ++ return addEffectToPlayersAround(level, source, pos, radius, mobeffect, effect, 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 ++ MobEffect mobeffectlist = 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(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1)); + }); + +- list.forEach((serverplayer) -> { +- serverplayer.addEffect(new MobEffectInstance(mobeffectinstance), entity); ++ list.forEach((entityplayer) -> { ++ entityplayer.addEffect(new MobEffectInstance(mobeffect), entity, cause); // CraftBukkit + }); + return list; + } |