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.world.World;
import net.minecraft.util.MovingObjectPosition;


public class FangornAuroch extends FangornAnimal {
    public FangornAuroch(World world) {
        super(world);
        setSize(1.5F, 1.7F);
    }

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

    protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.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 hides = 2 + rand.nextInt(3) + rand.nextInt(1 + i);
        for (int l = 0; l < hides; l++)
            dropItem(Items.leather, 1); 
        int meats = 2 + rand.nextInt(3) + rand.nextInt(1 + i);
        for (int j = 0; j < meats; j++) {
            if (isBurning()) {
                dropItem(Items.cooked_beef, 1);
            } else {
                dropItem(Items.beef, 1);
            } 
        } 
        dropItem(LOTRMod.horn, 1);
    }

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

    public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
        // No ranged attack implemented
    }
    @Override
    public ItemStack getPickedResult(MovingObjectPosition target) {
        return new ItemStack(CinderLoE.spawnEgg, 1, 30);
    }

}
