public function onUpdate($currentTick)
{
if ($this->closed) {
return false;
}
$this->timings->startTiming();
$hasUpdate = parent::onUpdate($currentTick);
if (!$this->hadCollision and $this->isCritical) {
$this->level->addParticle(new CriticalParticle($this->add($this->width / 2 + mt_rand(-100, 100) / 500, $this->height / 2 + mt_rand(-100, 100) / 500, $this->width / 2 + mt_rand(-100, 100) / 500)));
} elseif ($this->onGround) {
$this->isCritical = false;
}
if ($this->potionId != 0) {
if (!$this->onGround or $this->onGround and $currentTick % 4 == 0) {
$color = Potion::getColor($this->potionId - 1);
$this->level->addParticle(new MobSpellParticle($this->add($this->width / 2 + mt_rand(-100, 100) / 500, $this->height / 2 + mt_rand(-100, 100) / 500, $this->width / 2 + mt_rand(-100, 100) / 500), $color[0], $color[1], $color[2]));
}
$hasUpdate = true;
}
if ($this->age > 1200) {
$this->kill();
$hasUpdate = true;
}
$this->timings->stopTiming();
return $hasUpdate;
}