public function entityBaseTick($tickDiff = 1) { Timings::$timerLivingEntityBaseTick->startTiming(); $hasUpdate = parent::entityBaseTick($tickDiff); if ($this->isAlive()) { if ($this->isInsideOfSolid()) { $hasUpdate = true; $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1); $this->attack($ev->getFinalDamage(), $ev); } if (!$this->hasEffect(Effect::WATER_BREATHING) and $this->isInsideOfWater()) { if ($this instanceof WaterAnimal) { $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 300); } else { $hasUpdate = true; $airTicks = $this->getDataProperty(self::DATA_AIR) - $tickDiff; if ($airTicks <= -20) { $airTicks = 0; $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_DROWNING, 2); $this->attack($ev->getFinalDamage(), $ev); } $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $airTicks); } } else { if ($this instanceof WaterAnimal) { $hasUpdate = true; $airTicks = $this->getDataProperty(self::DATA_AIR) - $tickDiff; if ($airTicks <= -20) { $airTicks = 0; $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 2); $this->attack($ev->getFinalDamage(), $ev); } $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $airTicks); } else { $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 300); } } } if ($this->attackTime > 0) { $this->attackTime -= $tickDiff; } Timings::$timerLivingEntityBaseTick->stopTiming(); return $hasUpdate; }