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

import com.zivilon.cinder_loe.CinderLoE;

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;


public class FangornWildBoar extends FangornAnimal {
    public FangornWildBoar(World world) {
        super(world);
        setSize(0.9F, 0.8F);
    }

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

    protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.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 meat = rand.nextInt(3) + 1 + rand.nextInt(1 + i);
        for (int l = 0; l < meat; l++) {
            if (isBurning()) {
                dropItem(Items.cooked_porkchop, 1);
            } else {
                dropItem(Items.porkchop, 1);
            } 
        } 
    }
    protected String getLivingSound() {
        return "mob.pig.say";
    }
      
    protected String getHurtSound() {
        return "mob.pig.say";
    }
      
    protected String getDeathSound() {
        return "mob.pig.death";
    }

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

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