public function onUpdate($currentTick)
{
if ($this->closed !== false) {
return false;
}
$tickDiff = $currentTick - $this->lastUpdate;
if ($tickDiff <= 1) {
return false;
}
$this->lastUpdate = $currentTick;
$this->timings->startTiming();
$hasUpdate = false;
//parent::onUpdate($currentTick);
if ($this->isAlive()) {
$p = $this->getLinkedEntity();
if ($p instanceof Player) {
if ($this->state === Minecart::STATE_INITIAL) {
$this->checkIfOnRail();
} elseif ($this->state === Minecart::STATE_ON_RAIL) {
$hasUpdate = $this->forwardOnRail($p);
$this->updateMovement();
}
}
}
$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;
}