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 aog, final float float2) {
        if (aog.isNoCounter()) {
            return "**:**";
        }
        final int integer3 = Mth.floor(aog.getDuration() * float2);
        return StringUtil.formatTickDuration(integer3);
    }
    
    public static boolean hasDigSpeed(final LivingEntity aoy) {
        return aoy.hasEffect(MobEffects.DIG_SPEED) || aoy.hasEffect(MobEffects.CONDUIT_POWER);
    }
    
    public static int getDigSpeedAmplification(final LivingEntity aoy) {
        int integer2 = 0;
        int integer3 = 0;
        if (aoy.hasEffect(MobEffects.DIG_SPEED)) {
            integer2 = aoy.getEffect(MobEffects.DIG_SPEED).getAmplifier();
        }
        if (aoy.hasEffect(MobEffects.CONDUIT_POWER)) {
            integer3 = aoy.getEffect(MobEffects.CONDUIT_POWER).getAmplifier();
        }
        return Math.max(integer2, integer3);
    }
    
    public static boolean hasWaterBreathing(final LivingEntity aoy) {
        return aoy.hasEffect(MobEffects.WATER_BREATHING) || aoy.hasEffect(MobEffects.CONDUIT_POWER);
    }
}
