package net.minecraft.world.entity.monster;

import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundEvent;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.EntityType;

public class Husk extends Zombie {
    public Husk(final EntityType<? extends Husk> aku, final Level bjw) {
        super(aku, bjw);
    }
    
    public static boolean checkHuskSpawnRules(final EntityType<Husk> aku, final LevelAccessor bjx, final MobSpawnType alc, final BlockPos fk, final Random random) {
        return Monster.checkMonsterSpawnRules(aku, bjx, alc, fk, random) && (alc == MobSpawnType.SPAWNER || bjx.canSeeSky(fk));
    }
    
    @Override
    protected boolean isSunSensitive() {
        return false;
    }
    
    @Override
    protected SoundEvent getAmbientSound() {
        return SoundEvents.HUSK_AMBIENT;
    }
    
    @Override
    protected SoundEvent getHurtSound(final DamageSource ajz) {
        return SoundEvents.HUSK_HURT;
    }
    
    @Override
    protected SoundEvent getDeathSound() {
        return SoundEvents.HUSK_DEATH;
    }
    
    @Override
    protected SoundEvent getStepSound() {
        return SoundEvents.HUSK_STEP;
    }
    
    @Override
    public boolean doHurtTarget(final Entity akq) {
        final boolean boolean3 = super.doHurtTarget(akq);
        if (boolean3 && this.getMainHandItem().isEmpty() && akq instanceof LivingEntity) {
            final float float4 = this.level.getCurrentDifficultyAt(new BlockPos(this)).getEffectiveDifficulty();
            ((LivingEntity)akq).addEffect(new MobEffectInstance(MobEffects.HUNGER, 140 * (int)float4));
        }
        return boolean3;
    }
    
    @Override
    protected boolean convertsInWater() {
        return true;
    }
    
    @Override
    protected void doUnderWaterConversion() {
        this.convertTo(EntityType.ZOMBIE);
        this.level.levelEvent(null, 1041, new BlockPos(this), 0);
    }
    
    @Override
    protected ItemStack getSkull() {
        return ItemStack.EMPTY;
    }
}
