public function addSound(Sound $sound, array $players = null) { $pk = $sound->encode(); if ($players === null) { if ($pk !== null) { if (!is_array($pk)) { $this->addChunkPacket($sound->x >> 4, $sound->z >> 4, $pk); } else { foreach ($pk as $e) { $this->addChunkPacket($sound->x >> 4, $sound->z >> 4, $e); } } } } else { if ($pk !== null) { if (!is_array($pk)) { Server::broadcastPacket($players, $pk); } else { $this->server->batchPackets($players, $pk, false); } } } }
public function __construct(Vector3 $pos, $id, $pitch = 0) { parent::__construct($pos->x, $pos->y, $pos->z); $this->id = (int) $id; $this->pitch = (double) $pitch * 1000; }