/*******************************************************************************
* AbyssalCraft
* Copyright (c) 2012 - 2017 Shinoow.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Contributors:
* Shinoow - implementation
******************************************************************************/
package com.shinoow.abyssalcraft.common.entity;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
import com.shinoow.abyssalcraft.api.AbyssalCraftAPI;
import com.shinoow.abyssalcraft.init.ItemHandler;
import com.shinoow.abyssalcraft.lib.ACConfig;
import com.shinoow.abyssalcraft.lib.ACSounds;
public class EntityShadowTitan extends EntityMob {
public EntityShadowTitan(World par1World) {
super(par1World);
tasks.addTask(0, new EntityAISwimming(this));
tasks.addTask(2, new EntityAIAttackMelee(this, 0.35D, false));
tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 0.35D));
tasks.addTask(4, new EntityAIWander(this, 0.35D));
tasks.addTask(7, new EntityAILookIdle(this));
tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(64.0D);
getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(0.2D);
getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.699D);
if(ACConfig.hardcoreMode){
getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(400.0D);
getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(30.0D);
} else {
getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(200.0D);
getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(15.0D);
}
}
@Override
protected float getSoundPitch()
{
return rand.nextFloat() - rand.nextFloat() * 0.2F + 0.6F;
}
@Override
protected SoundEvent getHurtSound()
{
return ACSounds.shadow_hurt;
}
@Override
protected SoundEvent getDeathSound()
{
return ACSounds.shadow_death;
}
@Override
protected Item getDropItem()
{
return ItemHandler.shadowPlate;
}
@Override
public EnumCreatureAttribute getCreatureAttribute()
{
return AbyssalCraftAPI.SHADOW;
}
@Override
public void onLivingUpdate()
{
for (int i = 0; i < 2; ++i)
if(ACConfig.particleEntity)
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX + (rand.nextDouble() - 0.5D) * width, posY + rand.nextDouble() * height, posZ + (rand.nextDouble() - 0.5D) * width, 0.0D, 0.0D, 0.0D);
super.onLivingUpdate();
}
}