diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/effect/MobEffectUtil.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/effect/MobEffectUtil.java.patch | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/effect/MobEffectUtil.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/effect/MobEffectUtil.java.patch new file mode 100644 index 0000000000..29abdb70a3 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/effect/MobEffectUtil.java.patch @@ -0,0 +1,81 @@ +--- a/net/minecraft/world/effect/MobEffectUtil.java ++++ b/net/minecraft/world/effect/MobEffectUtil.java +@@ -12,12 +12,16 @@ + import net.minecraft.world.phys.Vec3; + + public final class MobEffectUtil { +- public static Component formatDuration(MobEffectInstance mobEffectInstance, float f, float f1) { +- if (mobEffectInstance.isInfiniteDuration()) { ++ ++ public MobEffectUtil() {} ++ ++ public static Component formatDuration(MobEffectInstance mobeffect, float f, float f1) { ++ if (mobeffect.isInfiniteDuration()) { + return Component.translatable("effect.duration.infinite"); + } else { +- int floor = Mth.floor((float)mobEffectInstance.getDuration() * f); +- return Component.literal(StringUtil.formatTickDuration(floor, f1)); ++ int i = Mth.floor((float) mobeffect.getDuration() * f); ++ ++ return Component.literal(StringUtil.formatTickDuration(i, f1)); + } + } + +@@ -27,37 +31,38 @@ + + public static int getDigSpeedAmplification(LivingEntity entity) { + int i = 0; +- int i1 = 0; ++ int j = 0; ++ + if (entity.hasEffect(MobEffects.DIG_SPEED)) { + i = entity.getEffect(MobEffects.DIG_SPEED).getAmplifier(); + } + + if (entity.hasEffect(MobEffects.CONDUIT_POWER)) { +- i1 = entity.getEffect(MobEffects.CONDUIT_POWER).getAmplifier(); ++ j = entity.getEffect(MobEffects.CONDUIT_POWER).getAmplifier(); + } + +- return Math.max(i, i1); ++ return Math.max(i, j); + } + + public static boolean hasWaterBreathing(LivingEntity entity) { + return entity.hasEffect(MobEffects.WATER_BREATHING) || entity.hasEffect(MobEffects.CONDUIT_POWER); + } + +- public static List<ServerPlayer> addEffectToPlayersAround( +- ServerLevel level, @Nullable Entity source, Vec3 pos, double radius, MobEffectInstance effect, int duration +- ) { +- MobEffect effect1 = effect.getEffect(); +- List<ServerPlayer> players = level.getPlayers( +- serverPlayer -> serverPlayer.gameMode.isSurvival() +- && (source == null || !source.isAlliedTo(serverPlayer)) +- && pos.closerThan(serverPlayer.position(), radius) +- && ( +- !serverPlayer.hasEffect(effect1) +- || serverPlayer.getEffect(effect1).getAmplifier() < effect.getAmplifier() +- || serverPlayer.getEffect(effect1).endsWithin(duration - 1) +- ) +- ); +- players.forEach(serverPlayer -> serverPlayer.addEffect(new MobEffectInstance(effect), source)); +- return players; ++ 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((entityplayer) -> { ++ entityplayer.addEffect(new MobEffectInstance(mobeffect), entity, cause); // CraftBukkit ++ }); ++ return list; ++ } + } |