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

import com.zivilon.cinder_loe.CinderLoE;

import lotr.common.LOTRMod;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

import java.util.UUID;


public class FangornElk extends FangornAnimal {
    public FangornElk(World world) {
        super(world);
        setSize(1.6F, 1.8F);
    }

    public void entityInit() {
        super.entityInit();
    }

    public void setUniqueID(UUID uuid) {
        entityUniqueID = uuid;
    }

    protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(35.0D);
        getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
        getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(8.0D);
    }

    
    public boolean attackEntityAsMob(Entity entity) {
        float f = (float)getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
        return entity.attackEntityFrom(DamageSource.causeMobDamage((EntityLivingBase)this), f);
    }

    protected void dropFewItems(boolean flag, int i) {
        int hide = rand.nextInt(3) + rand.nextInt(1 + i);
        for (int l = 0; l < hide; l++)
            dropItem(Items.leather, 1); 
        int meat = rand.nextInt(3) + rand.nextInt(1 + i);
        for (int j = 0; j < meat; j++) {
            if (isBurning()) {
                dropItem(LOTRMod.deerCooked, 1);
            } else {
                dropItem(LOTRMod.deerRaw, 1);
            } 
        } 
    }

    protected String getLivingSound() {
        return "lotr:elk.say";
    }
      
    protected String getHurtSound() {
        return "lotr:elk.hurt";
    }
      
    protected String getDeathSound() {
        return "lotr:elk.death";
    }

    public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
        // No ranged attack implemented
    }

    @Override
    public ItemStack getPickedResult(MovingObjectPosition target) {
        return new ItemStack(CinderLoE.spawnEgg, 1, 26);
    }
}
