package net.minecraft.world.entity.monster;

import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.Pose;
import net.minecraft.nbt.CompoundTag;
import javax.annotation.Nullable;
import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.item.Items;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.EntityType;

public class WitherSkeleton extends AbstractSkeleton {
    public WitherSkeleton(final EntityType<? extends WitherSkeleton> aku, final Level bjw) {
        super(aku, bjw);
        this.setPathfindingMalus(BlockPathTypes.LAVA, 8.0f);
    }
    
    @Override
    protected SoundEvent getAmbientSound() {
        return SoundEvents.WITHER_SKELETON_AMBIENT;
    }
    
    @Override
    protected SoundEvent getHurtSound(final DamageSource ajz) {
        return SoundEvents.WITHER_SKELETON_HURT;
    }
    
    @Override
    protected SoundEvent getDeathSound() {
        return SoundEvents.WITHER_SKELETON_DEATH;
    }
    
    @Override
    SoundEvent getStepSound() {
        return SoundEvents.WITHER_SKELETON_STEP;
    }
    
    @Override
    protected void dropCustomDeathLoot(final DamageSource ajz, final int integer, final boolean boolean3) {
        super.dropCustomDeathLoot(ajz, integer, boolean3);
        final Entity akq5 = ajz.getEntity();
        if (akq5 instanceof Creeper) {
            final Creeper awi6 = (Creeper)akq5;
            if (awi6.canDropMobsSkull()) {
                awi6.increaseDroppedSkulls();
                this.spawnAtLocation(Items.WITHER_SKELETON_SKULL);
            }
        }
    }
    
    @Override
    protected void populateDefaultEquipmentSlots(final DifficultyInstance ajj) {
        this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.STONE_SWORD));
    }
    
    @Override
    protected void populateDefaultEquipmentEnchantments(final DifficultyInstance ajj) {
    }
    
    @Nullable
    @Override
    public SpawnGroupData finalizeSpawn(final LevelAccessor bjx, final DifficultyInstance ajj, final MobSpawnType alc, @Nullable final SpawnGroupData alm, @Nullable final CompoundTag jt) {
        final SpawnGroupData alm2 = super.finalizeSpawn(bjx, ajj, alc, alm, jt);
        this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0);
        this.reassessWeaponGoal();
        return alm2;
    }
    
    @Override
    protected float getStandingEyeHeight(final Pose alj, final EntityDimensions akr) {
        return 2.1f;
    }
    
    @Override
    public boolean doHurtTarget(final Entity akq) {
        if (!super.doHurtTarget(akq)) {
            return false;
        }
        if (akq instanceof LivingEntity) {
            ((LivingEntity)akq).addEffect(new MobEffectInstance(MobEffects.WITHER, 200));
        }
        return true;
    }
    
    @Override
    protected AbstractArrow getArrow(final ItemStack ben, final float float2) {
        final AbstractArrow ayn4 = super.getArrow(ben, float2);
        ayn4.setSecondsOnFire(100);
        return ayn4;
    }
    
    @Override
    public boolean canBeAffected(final MobEffectInstance akk) {
        return akk.getEffect() != MobEffects.WITHER && super.canBeAffected(akk);
    }
}
