Update EntityAPI.php

This commit is contained in:
ArkQuark 2022-10-20 23:35:02 +03:00
parent 7ea63bdceb
commit 83b7bc4b39
11 changed files with 380 additions and 57 deletions

View file

@ -6,24 +6,6 @@ class Arrow extends Projectile{
parent::__construct($level, $eid, $class, $type, $data);
//$this->server->schedule(1210, array($this, "update")); //Despawn
}
public function update(){
$now = microtime(true);
if(($now - $this->spawntime) >= 60){
$this->close();
return false;
}
$f3 = 0.99;
$f5 = 0.03;
$this->move(new Vector3($this->speedX, $this->speedY, $this->speedZ));
$this->speedX *= $f3;
$this->speedZ *= $f3;
$this->speedY -= $f5;
$this->server->api->handle("entity.move", $this);
$this->server->api->handle("entity.motion", $this);
$this->handleUpdate();
$this->server->schedule(1, array($this, "update"), false);
$this->lastUpdate = $now;
}
public function handleUpdate(){
$pk = new MoveEntityPacket_PosRot;
$pk->eid = $this->eid;