public function onUpdate($currentTick)
{
if ($this->closed) {
return false;
}
$tickDiff = $currentTick - $this->lastUpdate;
if ($tickDiff <= 0 and !$this->justCreated) {
return true;
}
$this->lastUpdate = $currentTick;
$this->timings->startTiming();
$hasUpdate = $this->entityBaseTick($tickDiff);
if (!$this->level->getBlock(new Vector3($this->x, $this->y, $this->z))->getBoundingBox() == null or $this->isInsideOfWater()) {
$this->motionY = 0.1;
} else {
$this->motionY = -0.08;
}
$this->move($this->motionX, $this->motionY, $this->motionZ);
$this->updateMovement();
if ($this->linkedEntity == null or $this->linkedType = 0) {
if ($this->age > 1500) {
$this->close();
$hasUpdate = true;
//$this->scheduleUpdate();
$this->age = 0;
}
$this->age++;
} else {
$this->age = 0;
}
$this->timings->stopTiming();
return $hasUpdate or !$this->onGround or abs($this->motionX) > 1.0E-5 or abs($this->motionY) > 1.0E-5 or abs($this->motionZ) > 1.0E-5;
}