BiomesOPlenty/src/minecraft/biomesoplenty/entities/EntityPhantom.java

91 lines
2.2 KiB
Java
Raw Normal View History

2013-08-30 11:38:54 +00:00
package biomesoplenty.entities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
2013-08-30 12:01:17 +00:00
import net.minecraft.item.ItemStack;
2013-08-30 11:38:54 +00:00
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
2013-08-30 12:01:17 +00:00
import biomesoplenty.api.Items;
2013-08-30 11:38:54 +00:00
import biomesoplenty.api.Potions;
public class EntityPhantom extends EntityMob
{
public EntityPhantom(World world)
{
super(world);
}
@Override
protected void func_110147_ax()
{
super.func_110147_ax();
//Max health
this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(20.0D);
//Movement speed
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.45D);
}
@Override
public void onEntityUpdate()
{
super.onEntityUpdate();
for (int i = 0; i < 3; i++)
{
this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0);
}
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
if (super.attackEntityAsMob(par1Entity))
{
if (par1Entity instanceof EntityLivingBase)
{
if (worldObj.difficultySetting > 1)
{
((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potions.possession.get().id, 40, 0));
}
}
return true;
}
else
{
return false;
}
}
2013-08-30 12:01:17 +00:00
@Override
protected void dropFewItems(boolean par1, int par2)
{
super.dropFewItems(par1, par2);
if (par1 && (this.rand.nextInt(3) == 0 || this.rand.nextInt(1 + par2) > 0))
{
this.entityDropItem(new ItemStack(Items.miscItems.get().itemID, 1, 16), 1);
}
}
2013-08-30 11:38:54 +00:00
@Override
protected String getLivingSound()
{
return "biomesoplenty:mob.phantom.say";
}
@Override
protected String getHurtSound()
{
return "biomesoplenty:mob.phantom.hurt";
}
@Override
protected String getDeathSound()
{
return "biomesoplenty:mob.phantom.death";
}
}