package com.zivilon.cinder_loe.entity.npc.dwarf;

import com.zivilon.cinder_loe.CinderLoE;

import lotr.common.entity.npc.LOTREntityDwarfAxeThrower;
import lotr.common.LOTRMod;
import lotr.common.entity.ai.LOTREntityAIRangedAttack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.init.Items;
import net.minecraft.util.MovingObjectPosition;


public class RedDwarfArbalest extends LOTREntityDwarfAxeThrower {
    public RedDwarfArbalest(World world) {
        super(world);
    }

    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        data = super.onSpawnWithEgg(data);
        int i = rand.nextInt(5);
        this.npcItemsInv.setRangedWeapon(new ItemStack(CinderLoE.crossbowRedDwarf));
        this.npcItemsInv.setIdleItem(this.npcItemsInv.getRangedWeapon());
        setCurrentItemOrArmor(1, new ItemStack(CinderLoE.bootsRedDwarf));
        setCurrentItemOrArmor(2, new ItemStack(CinderLoE.legsRedDwarf));
        setCurrentItemOrArmor(3, new ItemStack(CinderLoE.bodyRedDwarf));
        setCurrentItemOrArmor(4, null);
        if (rand.nextInt(10) != 0)
            setCurrentItemOrArmor(4, new ItemStack(CinderLoE.helmetRedDwarf)); 
        return data;
    }
    public void attackEntityWithRangedAttack(EntityLivingBase target, float f) {
        npcCrossbowAttack(target, f);
    }
    protected void dropFewItems(boolean flag, int i) {
        super.dropFewItems(flag, i);
        dropNPCCrossbowBolts(i);
    }
    @Override
    public ItemStack getPickedResult(MovingObjectPosition target) {
        return new ItemStack(CinderLoE.spawnEgg, 1, 11);
    }
}
