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

import com.zivilon.cinder_loe.CinderLoE;

import lotr.common.entity.npc.LOTREntityDwarfWarrior;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.item.Item;


public class RedDwarfWarrior extends LOTREntityDwarfWarrior {
    public RedDwarfWarrior(World world) {
        super(world);

        this.npcShield = LOTRShields.ALIGNMENT_DWARF;
    }

    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        data = super.onSpawnWithEgg(data);
        int i = rand.nextInt(6);
        if (i == 0) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.swordRedDwarf));
        } else if (i == 1 || i == 2) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.battleaxeRedDwarf));
        } else if (i == 3 || i == 4) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.pikeRedDwarf));
        } else if (i == 5) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.hammerRedDwarf));
        }
        if (rand.nextInt(6) == 0) {
            this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.spearRedDwarf));
        }
        this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
        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;
    }
    @Override
    public ItemStack getPickedResult(MovingObjectPosition target) {
        return new ItemStack(CinderLoE.spawnEgg, 1, 10);
    }

    @Override
    protected Item getDwarfSteelDrop() {
        return CinderLoE.redDwarfSteel;
    }
}
