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

encode() public method

public encode ( )
    public function encode()
    {
        if ($this->id > 1000) {
            $pk = new LevelEventPacket();
            $pk->evid = $this->id;
            $pk->x = $this->x;
            $pk->y = $this->y;
            $pk->z = $this->z;
            $pk->data = (int) $this->pitch;
        } else {
            $pk = new LevelSoundEventPacket();
            $pk->sound = $this->id;
            $pk->x = $this->x;
            $pk->y = $this->y;
            $pk->z = $this->z;
            $pk->type = $this->type;
            $pk->pitch = $this->pitch;
            $pk->unknownBool = $this->unknownBool;
            $pk->unknownBool2 = $this->unknownBool2;
        }
        return $pk;
    }