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->age > 1200 or $this->isCollided) {
$hasUpdate = true;
if ($this->isCollided and $this->canExplode) {
$this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 2.8));
if (!$ev->isCancelled()) {
$explosion = new Explosion($this, $ev->getForce(), $this->shootingEntity);
if ($ev->isBlockBreaking()) {
$explosion->explodeA();
}
$explosion->explodeB();
}
}
$this->kill();
}
$this->timings->stopTiming();
return $hasUpdate;
}