New fields for PlaySoundPacket and StopSoundPacket

This commit is contained in:
Dylan K. Taylor 2017-05-15 16:19:08 +01:00
parent 0a4d62b405
commit fe3b5bac51
2 changed files with 12 additions and 12 deletions

View File

@ -30,26 +30,26 @@ use pocketmine\network\mcpe\NetworkSession;
class PlaySoundPacket extends DataPacket{ class PlaySoundPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET; const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET;
public $string1; public $soundName;
public $x; public $x;
public $y; public $y;
public $z; public $z;
public $float1; public $volume;
public $float2; public $pitch;
public function decode(){ public function decode(){
$this->string1 = $this->getString(); $this->soundName = $this->getString();
$this->getBlockPosition($this->x, $this->y, $this->z); $this->getBlockPosition($this->x, $this->y, $this->z);
$this->float1 = $this->getLFloat(); $this->volume = $this->getLFloat();
$this->float2 = $this->getLFloat(); $this->pitch = $this->getLFloat();
} }
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putString($this->string1); $this->putString($this->soundName);
$this->putBlockPosition($this->x, $this->y, $this->z); $this->putBlockPosition($this->x, $this->y, $this->z);
$this->putLFloat($this->float1); $this->putLFloat($this->volume);
$this->putLFloat($this->float2); $this->putLFloat($this->pitch);
} }
public function handle(NetworkSession $session) : bool{ public function handle(NetworkSession $session) : bool{

View File

@ -30,17 +30,17 @@ use pocketmine\network\mcpe\NetworkSession;
class StopSoundPacket extends DataPacket{ class StopSoundPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::STOP_SOUND_PACKET; const NETWORK_ID = ProtocolInfo::STOP_SOUND_PACKET;
public $string1; public $soundName;
public $stopAll; public $stopAll;
public function decode(){ public function decode(){
$this->string1 = $this->getString(); $this->soundName = $this->getString();
$this->stopAll = $this->getBool(); $this->stopAll = $this->getBool();
} }
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putString($this->string1); $this->putString($this->soundName);
$this->putBool($this->stopAll); $this->putBool($this->stopAll);
} }