public function onUpdate($currentTick) { if ($this->closed) { return false; } $this->timings->startTiming(); $hasUpdate = parent::onUpdate($currentTick); $collector = null; if (!$this->collected) { foreach ($this->level->getPlayers() as $p) { if ($this->distanceSquared($p) <= 36) { //6 or less $collector = $p; $this->collected = true; break; } } } if ($this->age > 1200 || $this->collected) { $this->kill(); $hasUpdate = true; } if ($collector !== null) { $collector->giveExp($this->getAmount()); $this->kill(); } $this->timings->stopTiming(); return $hasUpdate; }
public function onUpdate($currentTick) { if ($this->closed) { return false; } $this->timings->startTiming(); $hasUpdate = parent::onUpdate($currentTick); if ($this->age > 1200) { $this->kill(); $hasUpdate = true; } $this->timings->stopTiming(); return $hasUpdate; }
public function onUpdate($currentTick) { if ($this->closed) { return false; } $this->timings->startTiming(); $hasUpdate = parent::onUpdate($currentTick); if ($this->age > 50) { $this->kill(); $hasUpdate = true; $this->getLevel()->dropItem($this, ItemItem::get(ItemItem::EYE_OF_ENDER), $this); } $this->timings->stopTiming(); return $hasUpdate; }