pocketmine\level\sound\GenericSound::__construct PHP Method

__construct() public method

public __construct ( Vector3 $pos, $id, $pitch )
$pos pocketmine\math\Vector3
    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;
    }

Usage Example

Example #1
0
 public function __construct(Vector3 $pos, $instrument = self::INSTRUMENT_PIANO, $pitch = 0)
 {
     parent::__construct($pos, 64, $pitch);
     $this->instrument = $instrument;
     $this->pitch = $pitch;
     $this->type = $this->instrument;
     $this->unknownBool = true;
     $this->unknownBool2 = true;
 }
All Usage Examples Of pocketmine\level\sound\GenericSound::__construct