package net.minecraft.world.effect;

import net.minecraft.world.entity.LivingEntity;
import net.minecraft.util.StringUtil;
import net.minecraft.util.Mth;

public final class MobEffectUtil {
    public static String formatDuration(final MobEffectInstance akk, final float float2) {
        if (akk.isNoCounter()) {
            return "**:**";
        }
        final int integer3 = Mth.floor(akk.getDuration() * float2);
        return StringUtil.formatTickDuration(integer3);
    }
    
    public static boolean hasDigSpeed(final LivingEntity akz) {
        return akz.hasEffect(MobEffects.DIG_SPEED) || akz.hasEffect(MobEffects.CONDUIT_POWER);
    }
    
    public static int getDigSpeedAmplification(final LivingEntity akz) {
        int integer2 = 0;
        int integer3 = 0;
        if (akz.hasEffect(MobEffects.DIG_SPEED)) {
            integer2 = akz.getEffect(MobEffects.DIG_SPEED).getAmplifier();
        }
        if (akz.hasEffect(MobEffects.CONDUIT_POWER)) {
            integer3 = akz.getEffect(MobEffects.CONDUIT_POWER).getAmplifier();
        }
        return Math.max(integer2, integer3);
    }
    
    public static boolean hasWaterBreathing(final LivingEntity akz) {
        return akz.hasEffect(MobEffects.WATER_BREATHING) || akz.hasEffect(MobEffects.CONDUIT_POWER);
    }
}
