package net.minecraft.entity.passive;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public abstract class EntityWaterMob extends EntityCreature implements IAnimals
{
private static final String __OBFID = "CL_00001653";
public EntityWaterMob(World p_i1695_1_)
{
super(p_i1695_1_);
}
public boolean canBreatheUnderwater()
{
return true;
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
return this.worldObj.checkNoEntityCollision(this.boundingBox);
}
/**
* Get number of ticks, at least during which the living entity will be silent.
*/
public int getTalkInterval()
{
return 120;
}
/**
* Determines if an entity can be despawned, used on idle far away entities
*/
protected boolean canDespawn()
{
return true;
}
/**
* Get the experience points the entity currently has.
*/
protected int getExperiencePoints(EntityPlayer p_70693_1_)
{
return 1 + this.worldObj.rand.nextInt(3);
}
/**
* Gets called every tick from main Entity class
*/
public void onEntityUpdate()
{
int i = this.getAir();
super.onEntityUpdate();
if (this.isEntityAlive() && !this.isInWater())
{
--i;
this.setAir(i);
if (this.getAir() == -20)
{
this.setAir(0);
this.attackEntityFrom(DamageSource.drown, 2.0F);
}
}
else
{
this.setAir(300);
}
}
}