mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
better entity linking system
This commit is contained in:
parent
c95a8d5cff
commit
d7763f445a
13 changed files with 353 additions and 227 deletions
|
|
@ -199,22 +199,25 @@ abstract class Projectile extends Entity{
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function spawn($player)
|
||||
public function spawn(Player $player)
|
||||
{
|
||||
$player->addEntity($this);
|
||||
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->eid = $this->eid;
|
||||
$pk->type = $this->type;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->speedX;
|
||||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
$pk->did = 0;
|
||||
$player->entityQueueDataPacket($pk);
|
||||
return true;
|
||||
if(!$player->hasEntity($this)){
|
||||
$player->addEntity($this);
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->eid = $this->eid;
|
||||
$pk->type = $this->type;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->speedX = $this->speedX;
|
||||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
$pk->did = 0;
|
||||
$player->entityQueueDataPacket($pk);
|
||||
$this->sendLinkPackets($player);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue