Inheritance: extends pocketmine\math\Vector3
示例#1
0
 public function __construct(Vector3 $pos, $id, $pitch = 0)
 {
     if (LevelSoundEventPacket::getSound($id) === false) {
         print "fail";
         return;
     }
     parent::__construct($pos->x, $pos->y, $pos->z);
     $this->id = $id;
     $this->pitch = (double) $pitch * 1000;
     $this->volume = (int) 100;
     $this->unknownBool = (bool) true;
     $this->unknownBool2 = (bool) true;
 }
示例#2
0
 public function __construct(Vector3 $pos, $id, $pitch = 0)
 {
     if ($this->id < 1000 && LevelSoundEventPacket::getSound($id) === false) {
         Server::getInstance()->getLogger()->warning("Sound with ID '" . $id . "' wasn't found.");
         return;
     }
     parent::__construct($pos->x, $pos->y, $pos->z);
     $this->id = (int) $id;
     $this->type = 0;
     //Noteblock type
     $this->pitch = (double) $pitch * 1000;
     $this->unknownBool = (bool) true;
     $this->unknownBool2 = (bool) true;
 }
示例#3
0
 public function addSound(Sound $sound, array $players = null)
 {
     $pk = $sound->encode();
     if ($players === null) {
         $players = $this->getUsingChunk($sound->x >> 4, $sound->z >> 4);
     }
     if ($pk !== null) {
         if (!is_array($pk)) {
             Server::broadcastPacket($players, $pk);
         } else {
             $this->server->batchPackets($players, $pk, false);
         }
     }
 }
示例#4
0
 public function addSound(Sound $sound, array $players = null)
 {
     $pk = $sound->encode();
     if ($players === null) {
         $players = $this->getUsingChunk($sound->x >> 4, $sound->z >> 4);
     }
     if ($pk !== null) {
         if (!is_array($pk)) {
             Server::broadcastPacket($players, $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
         } else {
             $this->server->batchPackets($players, $pk, false, Network::CHANNEL_WORLD_EVENTS);
         }
     }
 }
示例#5
0
 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);
             }
         }
     }
 }
示例#6
0
 public function __construct(Vector3 $pos, $r = 0, $g = 0, $b = 0)
 {
     parent::__construct($pos->x, $pos->y, $pos->z);
     $this->id = (int) LevelEventPacket::EVENT_SOUND_SPELL;
     $this->color = ($r << 16 | $g << 8 | $b) & 0xffffff;
 }
示例#7
0
 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;
 }
示例#8
0
 public function __construct(Vector3 $pos, $instrument = self::INSTRUMENT_PIANO, $pitch = 0)
 {
     parent::__construct($pos->x, $pos->y, $pos->z);
     $this->instrument = $instrument;
     $this->pitch = $pitch;
 }