shootingEntity = $shootingEntity; $this->isCritical = (bool) $critical; parent::__construct($chunk, $nbt); } 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){ $this->kill(); $hasUpdate = true; } $this->timings->stopTiming(); return $hasUpdate; } public function spawnTo(Player $player){ $pk = new AddEntityPacket(); $pk->type = Arrow::NETWORK_ID; $pk->eid = $this->getId(); $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; $pk->did = $this->shootingEntity !== null ? $this->shootingEntity->getId() : 1; $pk->speedX = $this->motionX; $pk->speedY = $this->motionY; $pk->speedZ = $this->motionZ; $player->dataPacket($pk); parent::spawnTo($player); } }