PocketMine-MP/src/network/mcpe/protocol/LevelSoundEventPacketV2.php
Dylan K. Taylor 1b26cf1df9 break the hard cycle between mcpe\handler and mcpe\protocol
preparing to move mcpe\protocol to a separate library
2020-04-23 15:38:11 +01:00

72 lines
2.0 KiB
PHP

<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\serializer\NetworkBinaryStream;
/**
* Useless leftover from a 1.9 refactor, does nothing
*/
class LevelSoundEventPacketV2 extends DataPacket{
public const NETWORK_ID = ProtocolInfo::LEVEL_SOUND_EVENT_PACKET_V2;
/** @var int */
public $sound;
/** @var Vector3 */
public $position;
/** @var int */
public $extraData = -1;
/** @var string */
public $entityType = ":"; //???
/** @var bool */
public $isBabyMob = false; //...
/** @var bool */
public $disableRelativeVolume = false;
protected function decodePayload(NetworkBinaryStream $in) : void{
$this->sound = $in->getByte();
$this->position = $in->getVector3();
$this->extraData = $in->getVarInt();
$this->entityType = $in->getString();
$this->isBabyMob = $in->getBool();
$this->disableRelativeVolume = $in->getBool();
}
protected function encodePayload(NetworkBinaryStream $out) : void{
$out->putByte($this->sound);
$out->putVector3($this->position);
$out->putVarInt($this->extraData);
$out->putString($this->entityType);
$out->putBool($this->isBabyMob);
$out->putBool($this->disableRelativeVolume);
}
public function handle(PacketHandlerInterface $handler) : bool{
return $handler->handleLevelSoundEventPacketV2($this);
}
}