mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Update EntityAPI.php
This commit is contained in:
parent
7ea63bdceb
commit
83b7bc4b39
11 changed files with 380 additions and 57 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue