
net.minecraft.server.EntityWaterAnimal Maven / Gradle / Ivy
package net.minecraft.server;
public abstract class EntityWaterAnimal extends EntityInsentient implements IAnimal {
public EntityWaterAnimal(World world) {
super(world);
}
public boolean canBreatheUnderwater() {
return true;
}
public boolean getCanSpawnHere() {
return true;
}
public boolean isNotColliding() {
return this.world.a(this.getBoundingBox(), this);
}
public int getTalkInterval() {
return 120;
}
protected boolean isTypeNotPersistent() {
return true;
}
protected int getExpValue(EntityHuman player) {
return 1 + this.world.random.nextInt(3);
}
public void onEntityUpdate() {
int i = this.getAirTicks();
super.onEntityUpdate();
if (this.isAlive() && !this.isInWater()) {
--i;
this.setAirTicks(i);
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
this.damageEntity(DamageSource.DROWN, 2.0F);
}
} else {
this.setAirTicks(300);
}
}
public boolean isPushedByWater() {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy