mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 11:27:07 +00:00
Rename NetworkBinaryStream -> PacketSerializer
This commit is contained in:
parent
c6557f0222
commit
6c096c44aa
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ActorEventPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ACTOR_EVENT_PACKET;
|
||||
@ -105,13 +105,13 @@ class ActorEventPacket extends DataPacket implements ClientboundPacket, Serverbo
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->event = $in->getByte();
|
||||
$this->data = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putByte($this->event);
|
||||
$out->putVarInt($this->data);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ActorFallPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ACTOR_FALL_PACKET;
|
||||
@ -37,13 +37,13 @@ class ActorFallPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var bool */
|
||||
public $isInVoid;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->fallDistance = $in->getLFloat();
|
||||
$this->isInVoid = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putLFloat($this->fallDistance);
|
||||
$out->putBool($this->isInVoid);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ActorPickRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ACTOR_PICK_REQUEST_PACKET;
|
||||
@ -35,12 +35,12 @@ class ActorPickRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $hotbarSlot;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityUniqueId = $in->getLLong();
|
||||
$this->hotbarSlot = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putLLong($this->entityUniqueId);
|
||||
$out->putByte($this->hotbarSlot);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\Attribute;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityLink;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty;
|
||||
@ -62,7 +62,7 @@ class AddActorPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var EntityLink[] */
|
||||
public $links = [];
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityUniqueId = $in->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->type = $in->getString();
|
||||
@ -88,7 +88,7 @@ class AddActorPacket extends DataPacket implements ClientboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putString($this->type);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class AddBehaviorTreePacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_BEHAVIOR_TREE_PACKET;
|
||||
@ -33,11 +33,11 @@ class AddBehaviorTreePacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var string */
|
||||
public $behaviorTreeJson;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->behaviorTreeJson = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->behaviorTreeJson);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class AddEntityPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET;
|
||||
@ -43,11 +43,11 @@ class AddEntityPacket extends DataPacket implements ClientboundPacket{
|
||||
return $this->uvarint1;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->uvarint1 = $in->getUnsignedVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->uvarint1);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
|
||||
@ -51,7 +51,7 @@ class AddItemActorPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var bool */
|
||||
public $isFromFishing = false;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityUniqueId = $in->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->item = $in->getSlot();
|
||||
@ -61,7 +61,7 @@ class AddItemActorPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->isFromFishing = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putSlot($this->item);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class AddPaintingPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ADD_PAINTING_PACKET;
|
||||
@ -42,7 +42,7 @@ class AddPaintingPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var string */
|
||||
public $title;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityUniqueId = $in->getEntityUniqueId();
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->position = $in->getVector3();
|
||||
@ -50,7 +50,7 @@ class AddPaintingPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->title = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putVector3($this->position);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\DeviceOS;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityLink;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty;
|
||||
@ -88,7 +88,7 @@ class AddPlayerPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var int */
|
||||
public $buildPlatform = DeviceOS::UNKNOWN;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->uuid = $in->getUUID();
|
||||
$this->username = $in->getString();
|
||||
$this->entityUniqueId = $in->getEntityUniqueId();
|
||||
@ -119,7 +119,7 @@ class AddPlayerPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->buildPlatform = $in->getLInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUUID($this->uuid);
|
||||
$out->putString($this->username);
|
||||
$out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
|
||||
|
||||
class AdventureSettingsPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
@ -75,7 +75,7 @@ class AdventureSettingsPacket extends DataPacket implements ClientboundPacket, S
|
||||
/** @var int */
|
||||
public $entityUniqueId; //This is a little-endian long, NOT a var-long. (WTF Mojang)
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->flags = $in->getUnsignedVarInt();
|
||||
$this->commandPermission = $in->getUnsignedVarInt();
|
||||
$this->flags2 = $in->getUnsignedVarInt();
|
||||
@ -84,7 +84,7 @@ class AdventureSettingsPacket extends DataPacket implements ClientboundPacket, S
|
||||
$this->entityUniqueId = $in->getLLong();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->flags);
|
||||
$out->putUnsignedVarInt($this->commandPermission);
|
||||
$out->putUnsignedVarInt($this->flags2);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class AnimatePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ANIMATE_PACKET;
|
||||
@ -58,7 +58,7 @@ class AnimatePacket extends DataPacket implements ClientboundPacket, Serverbound
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->action = $in->getVarInt();
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
if(($this->action & 0x80) !== 0){
|
||||
@ -66,7 +66,7 @@ class AnimatePacket extends DataPacket implements ClientboundPacket, Serverbound
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->action);
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
if(($this->action & 0x80) !== 0){
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class AnvilDamagePacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ANVIL_DAMAGE_PACKET;
|
||||
@ -62,12 +62,12 @@ class AnvilDamagePacket extends DataPacket implements ServerboundPacket{
|
||||
return $this->z;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->damageAmount = $in->getByte();
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->damageAmount);
|
||||
$out->putBlockPosition($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class AutomationClientConnectPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::AUTOMATION_CLIENT_CONNECT_PACKET;
|
||||
@ -33,11 +33,11 @@ class AutomationClientConnectPacket extends DataPacket implements ClientboundPac
|
||||
/** @var string */
|
||||
public $serverUri;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->serverUri = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->serverUri);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\CacheableNbt;
|
||||
|
||||
class AvailableActorIdentifiersPacket extends DataPacket implements ClientboundPacket{
|
||||
@ -46,11 +46,11 @@ class AvailableActorIdentifiersPacket extends DataPacket implements ClientboundP
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->identifiers = new CacheableNbt($in->getNbtCompoundRoot());
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->put($this->identifiers->getEncodedNbt());
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\command\CommandData;
|
||||
use pocketmine\network\mcpe\protocol\types\command\CommandEnum;
|
||||
use pocketmine\network\mcpe\protocol\types\command\CommandEnumConstraint;
|
||||
@ -108,7 +108,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
*/
|
||||
public $enumConstraints = [];
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
/** @var string[] $enumValues */
|
||||
$enumValues = [];
|
||||
for($i = 0, $enumValuesCount = $in->getUnsignedVarInt(); $i < $enumValuesCount; ++$i){
|
||||
@ -149,7 +149,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
* @throws PacketDecodeException
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
protected function getEnum(array $enumValueList, NetworkBinaryStream $in) : CommandEnum{
|
||||
protected function getEnum(array $enumValueList, PacketSerializer $in) : CommandEnum{
|
||||
$enumName = $in->getString();
|
||||
$enumValues = [];
|
||||
|
||||
@ -170,7 +170,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
/**
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
protected function getSoftEnum(NetworkBinaryStream $in) : CommandEnum{
|
||||
protected function getSoftEnum(PacketSerializer $in) : CommandEnum{
|
||||
$enumName = $in->getString();
|
||||
$enumValues = [];
|
||||
|
||||
@ -185,7 +185,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
/**
|
||||
* @param int[] $enumValueMap
|
||||
*/
|
||||
protected function putEnum(CommandEnum $enum, array $enumValueMap, NetworkBinaryStream $out) : void{
|
||||
protected function putEnum(CommandEnum $enum, array $enumValueMap, PacketSerializer $out) : void{
|
||||
$out->putString($enum->getName());
|
||||
|
||||
$values = $enum->getValues();
|
||||
@ -200,7 +200,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function putSoftEnum(CommandEnum $enum, NetworkBinaryStream $out) : void{
|
||||
protected function putSoftEnum(CommandEnum $enum, PacketSerializer $out) : void{
|
||||
$out->putString($enum->getName());
|
||||
|
||||
$values = $enum->getValues();
|
||||
@ -213,7 +213,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
/**
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
protected function getEnumValueIndex(int $valueCount, NetworkBinaryStream $in) : int{
|
||||
protected function getEnumValueIndex(int $valueCount, PacketSerializer $in) : int{
|
||||
if($valueCount < 256){
|
||||
return $in->getByte();
|
||||
}elseif($valueCount < 65536){
|
||||
@ -223,7 +223,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function putEnumValueIndex(int $index, int $valueCount, NetworkBinaryStream $out) : void{
|
||||
protected function putEnumValueIndex(int $index, int $valueCount, PacketSerializer $out) : void{
|
||||
if($valueCount < 256){
|
||||
$out->putByte($index);
|
||||
}elseif($valueCount < 65536){
|
||||
@ -240,7 +240,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
* @throws PacketDecodeException
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
protected function getEnumConstraint(array $enums, array $enumValues, NetworkBinaryStream $in) : CommandEnumConstraint{
|
||||
protected function getEnumConstraint(array $enums, array $enumValues, PacketSerializer $in) : CommandEnumConstraint{
|
||||
//wtf, what was wrong with an offset inside the enum? :(
|
||||
$valueIndex = $in->getLInt();
|
||||
if(!isset($enumValues[$valueIndex])){
|
||||
@ -268,7 +268,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
* @param int[] $enumIndexes string enum name -> int index
|
||||
* @param int[] $enumValueIndexes string value -> int index
|
||||
*/
|
||||
protected function putEnumConstraint(CommandEnumConstraint $constraint, array $enumIndexes, array $enumValueIndexes, NetworkBinaryStream $out) : void{
|
||||
protected function putEnumConstraint(CommandEnumConstraint $constraint, array $enumIndexes, array $enumValueIndexes, PacketSerializer $out) : void{
|
||||
$out->putLInt($enumValueIndexes[$constraint->getAffectedValue()]);
|
||||
$out->putLInt($enumIndexes[$constraint->getEnum()->getName()]);
|
||||
$out->putUnsignedVarInt(count($constraint->getConstraints()));
|
||||
@ -284,7 +284,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
* @throws PacketDecodeException
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
protected function getCommandData(array $enums, array $postfixes, NetworkBinaryStream $in) : CommandData{
|
||||
protected function getCommandData(array $enums, array $postfixes, PacketSerializer $in) : CommandData{
|
||||
$name = $in->getString();
|
||||
$description = $in->getString();
|
||||
$flags = $in->getByte();
|
||||
@ -328,7 +328,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
* @param int[] $enumIndexes string enum name -> int index
|
||||
* @param int[] $postfixIndexes
|
||||
*/
|
||||
protected function putCommandData(CommandData $data, array $enumIndexes, array $postfixIndexes, NetworkBinaryStream $out) : void{
|
||||
protected function putCommandData(CommandData $data, array $enumIndexes, array $postfixIndexes, PacketSerializer $out) : void{
|
||||
$out->putString($data->name);
|
||||
$out->putString($data->description);
|
||||
$out->putByte($data->flags);
|
||||
@ -409,7 +409,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
||||
return "unknown ($argtype)";
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
/** @var int[] $enumValueIndexes */
|
||||
$enumValueIndexes = [];
|
||||
/** @var int[] $postfixIndexes */
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\CacheableNbt;
|
||||
|
||||
class BiomeDefinitionListPacket extends DataPacket implements ClientboundPacket{
|
||||
@ -46,11 +46,11 @@ class BiomeDefinitionListPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->defs = new CacheableNbt($in->getNbtCompoundRoot());
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->put($this->defs->getEncodedNbt());
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\CacheableNbt;
|
||||
|
||||
class BlockActorDataPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
@ -53,12 +53,12 @@ class BlockActorDataPacket extends DataPacket implements ClientboundPacket, Serv
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->namedtag = new CacheableNbt($in->getNbtCompoundRoot());
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$out->put($this->namedtag->getEncodedNbt());
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class BlockEventPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::BLOCK_EVENT_PACKET;
|
||||
@ -52,13 +52,13 @@ class BlockEventPacket extends DataPacket implements ClientboundPacket{
|
||||
return $pk;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->eventType = $in->getVarInt();
|
||||
$this->eventData = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$out->putVarInt($this->eventType);
|
||||
$out->putVarInt($this->eventData);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class BlockPickRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::BLOCK_PICK_REQUEST_PACKET;
|
||||
@ -41,13 +41,13 @@ class BlockPickRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $hotbarSlot;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$in->getSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
|
||||
$this->addUserData = $in->getBool();
|
||||
$this->hotbarSlot = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
|
||||
$out->putBool($this->addUserData);
|
||||
$out->putByte($this->hotbarSlot);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class BookEditPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::BOOK_EDIT_PACKET;
|
||||
@ -57,7 +57,7 @@ class BookEditPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var string */
|
||||
public $xuid;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->type = $in->getByte();
|
||||
$this->inventorySlot = $in->getByte();
|
||||
|
||||
@ -85,7 +85,7 @@ class BookEditPacket extends DataPacket implements ServerboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->type);
|
||||
$out->putByte($this->inventorySlot);
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class BossEventPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::BOSS_EVENT_PACKET;
|
||||
@ -118,7 +118,7 @@ class BossEventPacket extends DataPacket implements ClientboundPacket, Serverbou
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->bossEid = $in->getEntityUniqueId();
|
||||
$this->eventType = $in->getUnsignedVarInt();
|
||||
switch($this->eventType){
|
||||
@ -148,7 +148,7 @@ class BossEventPacket extends DataPacket implements ClientboundPacket, Serverbou
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->bossEid);
|
||||
$out->putUnsignedVarInt($this->eventType);
|
||||
switch($this->eventType){
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class CameraPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CAMERA_PACKET;
|
||||
@ -35,12 +35,12 @@ class CameraPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var int */
|
||||
public $playerUniqueId;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->cameraUniqueId = $in->getEntityUniqueId();
|
||||
$this->playerUniqueId = $in->getEntityUniqueId();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->cameraUniqueId);
|
||||
$out->putEntityUniqueId($this->playerUniqueId);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ChangeDimensionPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CHANGE_DIMENSION_PACKET;
|
||||
@ -38,13 +38,13 @@ class ChangeDimensionPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var bool */
|
||||
public $respawn = false;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->dimension = $in->getVarInt();
|
||||
$this->position = $in->getVector3();
|
||||
$this->respawn = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->dimension);
|
||||
$out->putVector3($this->position);
|
||||
$out->putBool($this->respawn);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ChunkRadiusUpdatedPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CHUNK_RADIUS_UPDATED_PACKET;
|
||||
@ -39,11 +39,11 @@ class ChunkRadiusUpdatedPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->radius = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->radius);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use function count;
|
||||
|
||||
class ClientCacheBlobStatusPacket extends DataPacket implements ServerboundPacket{
|
||||
@ -65,7 +65,7 @@ class ClientCacheBlobStatusPacket extends DataPacket implements ServerboundPacke
|
||||
return $this->missHashes;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$hitCount = $in->getUnsignedVarInt();
|
||||
$missCount = $in->getUnsignedVarInt();
|
||||
for($i = 0; $i < $hitCount; ++$i){
|
||||
@ -76,7 +76,7 @@ class ClientCacheBlobStatusPacket extends DataPacket implements ServerboundPacke
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt(count($this->hitHashes));
|
||||
$out->putUnsignedVarInt(count($this->missHashes));
|
||||
foreach($this->hitHashes as $hash){
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\ChunkCacheBlob;
|
||||
use function count;
|
||||
|
||||
@ -54,7 +54,7 @@ class ClientCacheMissResponsePacket extends DataPacket implements ClientboundPac
|
||||
return $this->blobs;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
for($i = 0, $count = $in->getUnsignedVarInt(); $i < $count; ++$i){
|
||||
$hash = $in->getLLong();
|
||||
$payload = $in->getString();
|
||||
@ -62,7 +62,7 @@ class ClientCacheMissResponsePacket extends DataPacket implements ClientboundPac
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt(count($this->blobs));
|
||||
foreach($this->blobs as $blob){
|
||||
$out->putLLong($blob->getHash());
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ClientCacheStatusPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CLIENT_CACHE_STATUS_PACKET;
|
||||
@ -43,11 +43,11 @@ class ClientCacheStatusPacket extends DataPacket implements ServerboundPacket{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->enabled = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBool($this->enabled);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ClientToServerHandshakePacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CLIENT_TO_SERVER_HANDSHAKE_PACKET;
|
||||
@ -34,11 +34,11 @@ class ClientToServerHandshakePacket extends DataPacket implements ServerboundPac
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
//No payload
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
//No payload
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\color\Color;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||
use pocketmine\network\mcpe\protocol\types\MapDecoration;
|
||||
use pocketmine\network\mcpe\protocol\types\MapTrackedObject;
|
||||
@ -71,7 +71,7 @@ class ClientboundMapItemDataPacket extends DataPacket implements ClientboundPack
|
||||
/** @var Color[][] */
|
||||
public $colors = [];
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->mapId = $in->getEntityUniqueId();
|
||||
$this->type = $in->getUnsignedVarInt();
|
||||
$this->dimensionId = $in->getByte();
|
||||
@ -132,7 +132,7 @@ class ClientboundMapItemDataPacket extends DataPacket implements ClientboundPack
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->mapId);
|
||||
|
||||
$type = 0;
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class CommandBlockUpdatePacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET;
|
||||
@ -62,7 +62,7 @@ class CommandBlockUpdatePacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var bool */
|
||||
public $executeOnFirstTick;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->isBlock = $in->getBool();
|
||||
|
||||
if($this->isBlock){
|
||||
@ -84,7 +84,7 @@ class CommandBlockUpdatePacket extends DataPacket implements ServerboundPacket{
|
||||
$this->executeOnFirstTick = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBool($this->isBlock);
|
||||
|
||||
if($this->isBlock){
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\command\CommandOriginData;
|
||||
use pocketmine\network\mcpe\protocol\types\command\CommandOutputMessage;
|
||||
use pocketmine\utils\BinaryDataException;
|
||||
@ -45,7 +45,7 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var string */
|
||||
public $unknownString;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->originData = $in->getCommandOriginData();
|
||||
$this->outputType = $in->getByte();
|
||||
$this->successCount = $in->getUnsignedVarInt();
|
||||
@ -62,7 +62,7 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
|
||||
/**
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
protected function getCommandMessage(NetworkBinaryStream $in) : CommandOutputMessage{
|
||||
protected function getCommandMessage(PacketSerializer $in) : CommandOutputMessage{
|
||||
$message = new CommandOutputMessage();
|
||||
|
||||
$message->isInternal = $in->getBool();
|
||||
@ -75,7 +75,7 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
|
||||
return $message;
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putCommandOriginData($this->originData);
|
||||
$out->putByte($this->outputType);
|
||||
$out->putUnsignedVarInt($this->successCount);
|
||||
@ -90,7 +90,7 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function putCommandMessage(CommandOutputMessage $message, NetworkBinaryStream $out) : void{
|
||||
protected function putCommandMessage(CommandOutputMessage $message, PacketSerializer $out) : void{
|
||||
$out->putBool($message->isInternal);
|
||||
$out->putString($message->messageId);
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\command\CommandOriginData;
|
||||
|
||||
class CommandRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
@ -38,13 +38,13 @@ class CommandRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var bool */
|
||||
public $isInternal;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->command = $in->getString();
|
||||
$this->originData = $in->getCommandOriginData();
|
||||
$this->isInternal = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->command);
|
||||
$out->putCommandOriginData($this->originData);
|
||||
$out->putBool($this->isInternal);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class CompletedUsingItemPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::COMPLETED_USING_ITEM_PACKET;
|
||||
@ -52,12 +52,12 @@ class CompletedUsingItemPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var int */
|
||||
public $action;
|
||||
|
||||
public function decodePayload(NetworkBinaryStream $in) : void{
|
||||
public function decodePayload(PacketSerializer $in) : void{
|
||||
$this->itemId = $in->getShort();
|
||||
$this->action = $in->getLInt();
|
||||
}
|
||||
|
||||
public function encodePayload(NetworkBinaryStream $out) : void{
|
||||
public function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putShort($this->itemId);
|
||||
$out->putLInt($this->action);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ContainerClosePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CONTAINER_CLOSE_PACKET;
|
||||
@ -39,11 +39,11 @@ class ContainerClosePacket extends DataPacket implements ClientboundPacket, Serv
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->windowId = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->windowId);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ContainerOpenPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CONTAINER_OPEN_PACKET;
|
||||
@ -65,14 +65,14 @@ class ContainerOpenPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->windowId = $in->getByte();
|
||||
$this->type = $in->getByte();
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->entityUniqueId = $in->getEntityUniqueId();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->windowId);
|
||||
$out->putByte($this->type);
|
||||
$out->putBlockPosition($this->x, $this->y, $this->z);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ContainerSetDataPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::CONTAINER_SET_DATA_PACKET;
|
||||
@ -55,13 +55,13 @@ class ContainerSetDataPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->windowId = $in->getByte();
|
||||
$this->property = $in->getVarInt();
|
||||
$this->value = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->windowId);
|
||||
$out->putVarInt($this->property);
|
||||
$out->putVarInt($this->value);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\PotionContainerChangeRecipe;
|
||||
use pocketmine\network\mcpe\protocol\types\PotionTypeRecipe;
|
||||
use pocketmine\network\mcpe\protocol\types\recipe\FurnaceRecipe;
|
||||
@ -56,7 +56,7 @@ class CraftingDataPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var bool */
|
||||
public $cleanRecipes = false;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$recipeCount = $in->getUnsignedVarInt();
|
||||
for($i = 0; $i < $recipeCount; ++$i){
|
||||
$recipeType = $in->getVarInt();
|
||||
@ -97,7 +97,7 @@ class CraftingDataPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->cleanRecipes = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt(count($this->entries));
|
||||
foreach($this->entries as $d){
|
||||
$out->putVarInt($d->getTypeId());
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
use pocketmine\uuid\UUID;
|
||||
use function count;
|
||||
@ -44,7 +44,7 @@ class CraftingEventPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var ItemStack[] */
|
||||
public $output = [];
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->windowId = $in->getByte();
|
||||
$this->type = $in->getVarInt();
|
||||
$this->id = $in->getUUID();
|
||||
@ -60,7 +60,7 @@ class CraftingEventPacket extends DataPacket implements ServerboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->windowId);
|
||||
$out->putVarInt($this->type);
|
||||
$out->putUUID($this->id);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\utils\BinaryDataException;
|
||||
use function get_class;
|
||||
|
||||
@ -44,14 +44,14 @@ abstract class DataPacket implements Packet{
|
||||
/** @var int */
|
||||
public $recipientSubId = 0;
|
||||
|
||||
/** @var NetworkBinaryStream */
|
||||
/** @var PacketSerializer */
|
||||
private $buf;
|
||||
|
||||
public function __construct(){
|
||||
$this->buf = new NetworkBinaryStream();
|
||||
$this->buf = new PacketSerializer();
|
||||
}
|
||||
|
||||
public function getBinaryStream() : NetworkBinaryStream{
|
||||
public function getBinaryStream() : PacketSerializer{
|
||||
return $this->buf;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ abstract class DataPacket implements Packet{
|
||||
* @throws BinaryDataException
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
protected function decodeHeader(NetworkBinaryStream $in) : void{
|
||||
protected function decodeHeader(PacketSerializer $in) : void{
|
||||
$header = $in->getUnsignedVarInt();
|
||||
$pid = $header & self::PID_MASK;
|
||||
if($pid !== static::NETWORK_ID){
|
||||
@ -102,7 +102,7 @@ abstract class DataPacket implements Packet{
|
||||
* @throws PacketDecodeException
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
abstract protected function decodePayload(NetworkBinaryStream $in) : void;
|
||||
abstract protected function decodePayload(PacketSerializer $in) : void;
|
||||
|
||||
final public function encode() : void{
|
||||
$this->buf->reset();
|
||||
@ -110,7 +110,7 @@ abstract class DataPacket implements Packet{
|
||||
$this->encodePayload($this->buf);
|
||||
}
|
||||
|
||||
protected function encodeHeader(NetworkBinaryStream $out) : void{
|
||||
protected function encodeHeader(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt(
|
||||
static::NETWORK_ID |
|
||||
($this->senderSubId << self::SENDER_SUBCLIENT_ID_SHIFT) |
|
||||
@ -121,7 +121,7 @@ abstract class DataPacket implements Packet{
|
||||
/**
|
||||
* Encodes the packet body, without the packet ID or other generic header fields.
|
||||
*/
|
||||
abstract protected function encodePayload(NetworkBinaryStream $out) : void;
|
||||
abstract protected function encodePayload(PacketSerializer $out) : void;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class DisconnectPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::DISCONNECT_PACKET;
|
||||
@ -52,14 +52,14 @@ class DisconnectPacket extends DataPacket implements ClientboundPacket, Serverbo
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->hideDisconnectionScreen = $in->getBool();
|
||||
if(!$this->hideDisconnectionScreen){
|
||||
$this->message = $in->getString();
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBool($this->hideDisconnectionScreen);
|
||||
if(!$this->hideDisconnectionScreen){
|
||||
$out->putString($this->message);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class EducationSettingsPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::EDUCATION_SETTINGS_PACKET;
|
||||
@ -50,12 +50,12 @@ class EducationSettingsPacket extends DataPacket implements ClientboundPacket{
|
||||
return $this->hasQuiz;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->codeBuilderDefaultUri = $in->getString();
|
||||
$this->hasQuiz = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->codeBuilderDefaultUri);
|
||||
$out->putBool($this->hasQuiz);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class EmotePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::EMOTE_PACKET;
|
||||
@ -62,13 +62,13 @@ class EmotePacket extends DataPacket implements ClientboundPacket, ServerboundPa
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->emoteId = $in->getString();
|
||||
$this->flags = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putString($this->emoteId);
|
||||
$out->putByte($this->flags);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class EventPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::EVENT_PACKET;
|
||||
@ -56,7 +56,7 @@ class EventPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var int */
|
||||
public $type;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->playerRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->eventData = $in->getVarInt();
|
||||
$this->type = $in->getByte();
|
||||
@ -64,7 +64,7 @@ class EventPacket extends DataPacket implements ClientboundPacket{
|
||||
//TODO: nice confusing mess
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->playerRuntimeId);
|
||||
$out->putVarInt($this->eventData);
|
||||
$out->putByte($this->type);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class GameRulesChangedPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::GAME_RULES_CHANGED_PACKET;
|
||||
@ -36,11 +36,11 @@ class GameRulesChangedPacket extends DataPacket implements ClientboundPacket{
|
||||
*/
|
||||
public $gameRules = [];
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->gameRules = $in->getGameRules();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putGameRules($this->gameRules);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class GuiDataPickItemPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::GUI_DATA_PICK_ITEM_PACKET;
|
||||
@ -37,13 +37,13 @@ class GuiDataPickItemPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var int */
|
||||
public $hotbarSlot;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->itemDescription = $in->getString();
|
||||
$this->itemEffects = $in->getString();
|
||||
$this->hotbarSlot = $in->getLInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->itemDescription);
|
||||
$out->putString($this->itemEffects);
|
||||
$out->putLInt($this->hotbarSlot);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class HurtArmorPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::HURT_ARMOR_PACKET;
|
||||
@ -33,11 +33,11 @@ class HurtArmorPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var int */
|
||||
public $health;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->health = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->health);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class InteractPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::INTERACT_PACKET;
|
||||
@ -47,7 +47,7 @@ class InteractPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var float */
|
||||
public $z;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->action = $in->getByte();
|
||||
$this->target = $in->getEntityRuntimeId();
|
||||
|
||||
@ -59,7 +59,7 @@ class InteractPacket extends DataPacket implements ServerboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->action);
|
||||
$out->putEntityRuntimeId($this->target);
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
use function count;
|
||||
|
||||
@ -49,7 +49,7 @@ class InventoryContentPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->windowId = $in->getUnsignedVarInt();
|
||||
$count = $in->getUnsignedVarInt();
|
||||
for($i = 0; $i < $count; ++$i){
|
||||
@ -57,7 +57,7 @@ class InventoryContentPacket extends DataPacket implements ClientboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->windowId);
|
||||
$out->putUnsignedVarInt(count($this->items));
|
||||
foreach($this->items as $item){
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
|
||||
class InventorySlotPacket extends DataPacket implements ClientboundPacket{
|
||||
@ -47,13 +47,13 @@ class InventorySlotPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->windowId = $in->getUnsignedVarInt();
|
||||
$this->inventorySlot = $in->getUnsignedVarInt();
|
||||
$this->item = $in->getSlot();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->windowId);
|
||||
$out->putUnsignedVarInt($this->inventorySlot);
|
||||
$out->putSlot($this->item);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\MismatchTransactionData;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\NormalTransactionData;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ReleaseItemTransactionData;
|
||||
@ -48,7 +48,7 @@ class InventoryTransactionPacket extends DataPacket implements ClientboundPacket
|
||||
/** @var TransactionData */
|
||||
public $trData;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$transactionType = $in->getUnsignedVarInt();
|
||||
|
||||
switch($transactionType){
|
||||
@ -74,7 +74,7 @@ class InventoryTransactionPacket extends DataPacket implements ClientboundPacket
|
||||
$this->trData->decode($in);
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->trData->getTypeId());
|
||||
$this->trData->encode($out);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ItemFrameDropItemPacket extends DataPacket implements ServerboundPacket{
|
||||
|
||||
@ -38,11 +38,11 @@ class ItemFrameDropItemPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $z;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBlockPosition($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class LabTablePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::LAB_TABLE_PACKET;
|
||||
@ -47,13 +47,13 @@ class LabTablePacket extends DataPacket implements ClientboundPacket, Serverboun
|
||||
/** @var int */
|
||||
public $reactionType;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->type = $in->getByte();
|
||||
$in->getSignedBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->reactionType = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->type);
|
||||
$out->putSignedBlockPosition($this->x, $this->y, $this->z);
|
||||
$out->putByte($this->reactionType);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class LecternUpdatePacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::LECTERN_UPDATE_PACKET;
|
||||
@ -43,14 +43,14 @@ class LecternUpdatePacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var bool */
|
||||
public $dropBook;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->page = $in->getByte();
|
||||
$this->totalPages = $in->getByte();
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->dropBook = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->page);
|
||||
$out->putByte($this->totalPages);
|
||||
$out->putBlockPosition($this->x, $this->y, $this->z);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use function count;
|
||||
|
||||
class LevelChunkPacket extends DataPacket implements ClientboundPacket{
|
||||
@ -100,7 +100,7 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
|
||||
return $this->extraPayload;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->chunkX = $in->getVarInt();
|
||||
$this->chunkZ = $in->getVarInt();
|
||||
$this->subChunkCount = $in->getUnsignedVarInt();
|
||||
@ -113,7 +113,7 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->extraPayload = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->chunkX);
|
||||
$out->putVarInt($this->chunkZ);
|
||||
$out->putUnsignedVarInt($this->subChunkCount);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\CacheableNbt;
|
||||
|
||||
class LevelEventGenericPacket extends DataPacket implements ClientboundPacket{
|
||||
@ -58,12 +58,12 @@ class LevelEventGenericPacket extends DataPacket implements ClientboundPacket{
|
||||
return $this->eventData;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->eventId = $in->getVarInt();
|
||||
$this->eventData = new CacheableNbt($in->getNbtCompoundRoot());
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->eventId);
|
||||
$out->put($this->eventData->getEncodedNbt());
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class LevelEventPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::LEVEL_EVENT_PACKET;
|
||||
@ -133,13 +133,13 @@ class LevelEventPacket extends DataPacket implements ClientboundPacket{
|
||||
return self::create(self::EVENT_ADD_PARTICLE_MASK | $particleId, $data, $pos);
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->evid = $in->getVarInt();
|
||||
$this->position = $in->getVector3();
|
||||
$this->data = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->evid);
|
||||
$out->putVector3Nullable($this->position);
|
||||
$out->putVarInt($this->data);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class LevelSoundEventPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::LEVEL_SOUND_EVENT_PACKET;
|
||||
@ -335,7 +335,7 @@ class LevelSoundEventPacket extends DataPacket implements ClientboundPacket, Ser
|
||||
/** @var bool */
|
||||
public $disableRelativeVolume = false;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->sound = $in->getUnsignedVarInt();
|
||||
$this->position = $in->getVector3();
|
||||
$this->extraData = $in->getVarInt();
|
||||
@ -344,7 +344,7 @@ class LevelSoundEventPacket extends DataPacket implements ClientboundPacket, Ser
|
||||
$this->disableRelativeVolume = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->sound);
|
||||
$out->putVector3($this->position);
|
||||
$out->putVarInt($this->extraData);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
/**
|
||||
* Useless leftover from a 1.8 refactor, does nothing
|
||||
@ -47,7 +47,7 @@ class LevelSoundEventPacketV1 extends DataPacket{
|
||||
/** @var bool */
|
||||
public $disableRelativeVolume = false;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->sound = $in->getByte();
|
||||
$this->position = $in->getVector3();
|
||||
$this->extraData = $in->getVarInt();
|
||||
@ -56,7 +56,7 @@ class LevelSoundEventPacketV1 extends DataPacket{
|
||||
$this->disableRelativeVolume = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->sound);
|
||||
$out->putVector3($this->position);
|
||||
$out->putVarInt($this->extraData);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
/**
|
||||
* Useless leftover from a 1.9 refactor, does nothing
|
||||
@ -47,7 +47,7 @@ class LevelSoundEventPacketV2 extends DataPacket{
|
||||
/** @var bool */
|
||||
public $disableRelativeVolume = false;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->sound = $in->getByte();
|
||||
$this->position = $in->getVector3();
|
||||
$this->extraData = $in->getVarInt();
|
||||
@ -56,7 +56,7 @@ class LevelSoundEventPacketV2 extends DataPacket{
|
||||
$this->disableRelativeVolume = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->sound);
|
||||
$out->putVector3($this->position);
|
||||
$out->putVarInt($this->extraData);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\login\JwtChain;
|
||||
use pocketmine\utils\BinaryStream;
|
||||
use function is_object;
|
||||
@ -49,7 +49,7 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->protocol = $in->getInt();
|
||||
$this->decodeConnectionRequest($in->getString());
|
||||
}
|
||||
@ -74,7 +74,7 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
|
||||
$this->clientDataJwt = $connRequestReader->get($connRequestReader->getLInt());
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putInt($this->protocol);
|
||||
$out->putString($this->encodeConnectionRequest());
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class MapCreateLockedCopyPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MAP_CREATE_LOCKED_COPY_PACKET;
|
||||
@ -35,12 +35,12 @@ class MapCreateLockedCopyPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $newMapId;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->originalMapId = $in->getEntityUniqueId();
|
||||
$this->newMapId = $in->getEntityUniqueId();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->originalMapId);
|
||||
$out->putEntityUniqueId($this->newMapId);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class MapInfoRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MAP_INFO_REQUEST_PACKET;
|
||||
@ -33,11 +33,11 @@ class MapInfoRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $mapId;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->mapId = $in->getEntityUniqueId();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->mapId);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
|
||||
class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
@ -56,7 +56,7 @@ class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, S
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->head = $in->getSlot();
|
||||
$this->chest = $in->getSlot();
|
||||
@ -64,7 +64,7 @@ class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, S
|
||||
$this->feet = $in->getSlot();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putSlot($this->head);
|
||||
$out->putSlot($this->chest);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class MobEffectPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MOB_EFFECT_PACKET;
|
||||
@ -66,7 +66,7 @@ class MobEffectPacket extends DataPacket implements ClientboundPacket{
|
||||
return $pk;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->eventId = $in->getByte();
|
||||
$this->effectId = $in->getVarInt();
|
||||
@ -75,7 +75,7 @@ class MobEffectPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->duration = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putByte($this->eventId);
|
||||
$out->putVarInt($this->effectId);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
|
||||
class MobEquipmentPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
@ -52,7 +52,7 @@ class MobEquipmentPacket extends DataPacket implements ClientboundPacket, Server
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->item = $in->getSlot();
|
||||
$this->inventorySlot = $in->getByte();
|
||||
@ -60,7 +60,7 @@ class MobEquipmentPacket extends DataPacket implements ClientboundPacket, Server
|
||||
$this->windowId = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putSlot($this->item);
|
||||
$out->putByte($this->inventorySlot);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ModalFormRequestPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MODAL_FORM_REQUEST_PACKET;
|
||||
@ -42,12 +42,12 @@ class ModalFormRequestPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->formId = $in->getUnsignedVarInt();
|
||||
$this->formData = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->formId);
|
||||
$out->putString($this->formData);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ModalFormResponsePacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MODAL_FORM_RESPONSE_PACKET;
|
||||
@ -35,12 +35,12 @@ class ModalFormResponsePacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var string */
|
||||
public $formData; //json
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->formId = $in->getUnsignedVarInt();
|
||||
$this->formData = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->formId);
|
||||
$out->putString($this->formData);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class MoveActorAbsolutePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MOVE_ACTOR_ABSOLUTE_PACKET;
|
||||
@ -48,7 +48,7 @@ class MoveActorAbsolutePacket extends DataPacket implements ClientboundPacket, S
|
||||
/** @var float */
|
||||
public $zRot;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->flags = $in->getByte();
|
||||
$this->position = $in->getVector3();
|
||||
@ -57,7 +57,7 @@ class MoveActorAbsolutePacket extends DataPacket implements ClientboundPacket, S
|
||||
$this->zRot = $in->getByteRotation();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putByte($this->flags);
|
||||
$out->putVector3($this->position);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\utils\BinaryDataException;
|
||||
|
||||
class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
|
||||
@ -61,7 +61,7 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
|
||||
/**
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
private function maybeReadCoord(int $flag, NetworkBinaryStream $in) : int{
|
||||
private function maybeReadCoord(int $flag, PacketSerializer $in) : int{
|
||||
if(($this->flags & $flag) !== 0){
|
||||
return $in->getVarInt();
|
||||
}
|
||||
@ -71,14 +71,14 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
|
||||
/**
|
||||
* @throws BinaryDataException
|
||||
*/
|
||||
private function maybeReadRotation(int $flag, NetworkBinaryStream $in) : float{
|
||||
private function maybeReadRotation(int $flag, PacketSerializer $in) : float{
|
||||
if(($this->flags & $flag) !== 0){
|
||||
return $in->getByteRotation();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->flags = $in->getLShort();
|
||||
$this->xDiff = $this->maybeReadCoord(self::FLAG_HAS_X, $in);
|
||||
@ -89,19 +89,19 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->zRot = $this->maybeReadRotation(self::FLAG_HAS_ROT_Z, $in);
|
||||
}
|
||||
|
||||
private function maybeWriteCoord(int $flag, int $val, NetworkBinaryStream $out) : void{
|
||||
private function maybeWriteCoord(int $flag, int $val, PacketSerializer $out) : void{
|
||||
if(($this->flags & $flag) !== 0){
|
||||
$out->putVarInt($val);
|
||||
}
|
||||
}
|
||||
|
||||
private function maybeWriteRotation(int $flag, float $val, NetworkBinaryStream $out) : void{
|
||||
private function maybeWriteRotation(int $flag, float $val, PacketSerializer $out) : void{
|
||||
if(($this->flags & $flag) !== 0){
|
||||
$out->putByteRotation($val);
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putLShort($this->flags);
|
||||
$this->maybeWriteCoord(self::FLAG_HAS_X, $this->xDiff, $out);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class MovePlayerPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MOVE_PLAYER_PACKET;
|
||||
@ -57,7 +57,7 @@ class MovePlayerPacket extends DataPacket implements ClientboundPacket, Serverbo
|
||||
/** @var int */
|
||||
public $teleportItem = 0;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->position = $in->getVector3();
|
||||
$this->pitch = $in->getLFloat();
|
||||
@ -72,7 +72,7 @@ class MovePlayerPacket extends DataPacket implements ClientboundPacket, Serverbo
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putVector3($this->position);
|
||||
$out->putLFloat($this->pitch);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class MultiplayerSettingsPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MULTIPLAYER_SETTINGS_PACKET;
|
||||
@ -47,11 +47,11 @@ class MultiplayerSettingsPacket extends DataPacket implements ClientboundPacket,
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->action = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->action);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class NetworkChunkPublisherUpdatePacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::NETWORK_CHUNK_PUBLISHER_UPDATE_PACKET;
|
||||
@ -48,12 +48,12 @@ class NetworkChunkPublisherUpdatePacket extends DataPacket implements Clientboun
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$in->getSignedBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->radius = $in->getUnsignedVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putSignedBlockPosition($this->x, $this->y, $this->z);
|
||||
$out->putUnsignedVarInt($this->radius);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class NetworkSettingsPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::NETWORK_SETTINGS_PACKET;
|
||||
@ -46,11 +46,11 @@ class NetworkSettingsPacket extends DataPacket implements ClientboundPacket{
|
||||
return $this->compressionThreshold;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->compressionThreshold = $in->getLShort();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putLShort($this->compressionThreshold);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class NetworkStackLatencyPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::NETWORK_STACK_LATENCY_PACKET;
|
||||
@ -35,12 +35,12 @@ class NetworkStackLatencyPacket extends DataPacket implements ClientboundPacket,
|
||||
/** @var bool */
|
||||
public $needResponse;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->timestamp = $in->getLLong();
|
||||
$this->needResponse = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putLLong($this->timestamp);
|
||||
$out->putBool($this->needResponse);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class NpcRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::NPC_REQUEST_PACKET;
|
||||
@ -46,14 +46,14 @@ class NpcRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $actionType;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->requestType = $in->getByte();
|
||||
$this->commandString = $in->getString();
|
||||
$this->actionType = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putByte($this->requestType);
|
||||
$out->putString($this->commandString);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class OnScreenTextureAnimationPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ON_SCREEN_TEXTURE_ANIMATION_PACKET;
|
||||
@ -33,11 +33,11 @@ class OnScreenTextureAnimationPacket extends DataPacket implements ClientboundPa
|
||||
/** @var int */
|
||||
public $effectId;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->effectId = $in->getLInt(); //unsigned
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putLInt($this->effectId);
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
interface Packet{
|
||||
|
||||
public function getBinaryStream() : NetworkBinaryStream;
|
||||
public function getBinaryStream() : PacketSerializer;
|
||||
|
||||
public function pid() : int;
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class PhotoTransferPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::PHOTO_TRANSFER_PACKET;
|
||||
@ -37,13 +37,13 @@ class PhotoTransferPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var string */
|
||||
public $bookId; //photos are stored in a sibling directory to the games folder (screenshots/(some UUID)/bookID/example.png)
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->photoName = $in->getString();
|
||||
$this->photoData = $in->getString();
|
||||
$this->bookId = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->photoName);
|
||||
$out->putString($this->photoData);
|
||||
$out->putString($this->bookId);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class PlaySoundPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET;
|
||||
@ -43,7 +43,7 @@ class PlaySoundPacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var float */
|
||||
public $pitch;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->soundName = $in->getString();
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->x /= 8;
|
||||
@ -53,7 +53,7 @@ class PlaySoundPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->pitch = $in->getLFloat();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->soundName);
|
||||
$out->putBlockPosition((int) ($this->x * 8), (int) ($this->y * 8), (int) ($this->z * 8));
|
||||
$out->putLFloat($this->volume);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class PlayStatusPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::PLAY_STATUS_PACKET;
|
||||
@ -48,7 +48,7 @@ class PlayStatusPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->status = $in->getInt();
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ class PlayStatusPacket extends DataPacket implements ClientboundPacket{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putInt($this->status);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class PlayerActionPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::PLAYER_ACTION_PACKET;
|
||||
@ -70,14 +70,14 @@ class PlayerActionPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $face;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
$this->action = $in->getVarInt();
|
||||
$in->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->face = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
$out->putVarInt($this->action);
|
||||
$out->putBlockPosition($this->x, $this->y, $this->z);
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\InputMode;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayMode;
|
||||
use function assert;
|
||||
@ -127,7 +127,7 @@ class PlayerAuthInputPacket extends DataPacket implements ServerboundPacket{
|
||||
return $this->vrGazeDirection;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->yaw = $in->getLFloat();
|
||||
$this->pitch = $in->getLFloat();
|
||||
$this->position = $in->getVector3();
|
||||
@ -142,7 +142,7 @@ class PlayerAuthInputPacket extends DataPacket implements ServerboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putLFloat($this->yaw);
|
||||
$out->putLFloat($this->pitch);
|
||||
$out->putVector3($this->position);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds;
|
||||
|
||||
class PlayerHotbarPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
@ -46,13 +46,13 @@ class PlayerHotbarPacket extends DataPacket implements ClientboundPacket, Server
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->selectedHotbarSlot = $in->getUnsignedVarInt();
|
||||
$this->windowId = $in->getByte();
|
||||
$this->selectHotbarSlot = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->selectedHotbarSlot);
|
||||
$out->putByte($this->windowId);
|
||||
$out->putBool($this->selectHotbarSlot);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class PlayerInputPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::PLAYER_INPUT_PACKET;
|
||||
@ -39,14 +39,14 @@ class PlayerInputPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var bool */
|
||||
public $sneaking;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->motionX = $in->getLFloat();
|
||||
$this->motionY = $in->getLFloat();
|
||||
$this->jumping = $in->getBool();
|
||||
$this->sneaking = $in->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putLFloat($this->motionX);
|
||||
$out->putLFloat($this->motionY);
|
||||
$out->putBool($this->jumping);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerListEntry;
|
||||
use function count;
|
||||
|
||||
@ -60,7 +60,7 @@ class PlayerListPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->type = $in->getByte();
|
||||
$count = $in->getUnsignedVarInt();
|
||||
for($i = 0; $i < $count; ++$i){
|
||||
@ -89,7 +89,7 @@ class PlayerListPacket extends DataPacket implements ClientboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->type);
|
||||
$out->putUnsignedVarInt(count($this->entries));
|
||||
foreach($this->entries as $entry){
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\SkinData;
|
||||
use pocketmine\uuid\UUID;
|
||||
|
||||
@ -41,7 +41,7 @@ class PlayerSkinPacket extends DataPacket implements ClientboundPacket, Serverbo
|
||||
/** @var SkinData */
|
||||
public $skin;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->uuid = $in->getUUID();
|
||||
$this->skin = $in->getSkin();
|
||||
$this->newSkinName = $in->getString();
|
||||
@ -49,7 +49,7 @@ class PlayerSkinPacket extends DataPacket implements ClientboundPacket, Serverbo
|
||||
$this->skin->setVerified($in->getBool());
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUUID($this->uuid);
|
||||
$out->putSkin($this->skin);
|
||||
$out->putString($this->newSkinName);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use function count;
|
||||
|
||||
class PurchaseReceiptPacket extends DataPacket implements ServerboundPacket{
|
||||
@ -34,14 +34,14 @@ class PurchaseReceiptPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var string[] */
|
||||
public $entries = [];
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$count = $in->getUnsignedVarInt();
|
||||
for($i = 0; $i < $count; ++$i){
|
||||
$this->entries[] = $in->getString();
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt(count($this->entries));
|
||||
foreach($this->entries as $entry){
|
||||
$out->putString($entry);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class RemoveActorPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::REMOVE_ACTOR_PACKET;
|
||||
@ -39,11 +39,11 @@ class RemoveActorPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->entityUniqueId = $in->getEntityUniqueId();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putEntityUniqueId($this->entityUniqueId);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class RemoveEntityPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::REMOVE_ENTITY_PACKET;
|
||||
@ -43,11 +43,11 @@ class RemoveEntityPacket extends DataPacket implements ClientboundPacket{
|
||||
return $this->uvarint1;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->uvarint1 = $in->getUnsignedVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putUnsignedVarInt($this->uvarint1);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class RemoveObjectivePacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::REMOVE_OBJECTIVE_PACKET;
|
||||
@ -33,11 +33,11 @@ class RemoveObjectivePacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var string */
|
||||
public $objectiveName;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->objectiveName = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->objectiveName);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class RequestChunkRadiusPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET;
|
||||
@ -33,11 +33,11 @@ class RequestChunkRadiusPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $radius;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->radius = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->radius);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ResourcePackChunkDataPacket extends DataPacket implements ClientboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET;
|
||||
@ -48,14 +48,14 @@ class ResourcePackChunkDataPacket extends DataPacket implements ClientboundPacke
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->packId = $in->getString();
|
||||
$this->chunkIndex = $in->getLInt();
|
||||
$this->progress = $in->getLLong();
|
||||
$this->data = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->packId);
|
||||
$out->putLInt($this->chunkIndex);
|
||||
$out->putLLong($this->progress);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ResourcePackChunkRequestPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_REQUEST_PACKET;
|
||||
@ -35,12 +35,12 @@ class ResourcePackChunkRequestPacket extends DataPacket implements ServerboundPa
|
||||
/** @var int */
|
||||
public $chunkIndex;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->packId = $in->getString();
|
||||
$this->chunkIndex = $in->getLInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->packId);
|
||||
$out->putLInt($this->chunkIndex);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use function count;
|
||||
|
||||
class ResourcePackClientResponsePacket extends DataPacket implements ServerboundPacket{
|
||||
@ -41,7 +41,7 @@ class ResourcePackClientResponsePacket extends DataPacket implements Serverbound
|
||||
/** @var string[] */
|
||||
public $packIds = [];
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->status = $in->getByte();
|
||||
$entryCount = $in->getLShort();
|
||||
while($entryCount-- > 0){
|
||||
@ -49,7 +49,7 @@ class ResourcePackClientResponsePacket extends DataPacket implements Serverbound
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putByte($this->status);
|
||||
$out->putLShort(count($this->packIds));
|
||||
foreach($this->packIds as $id){
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\resourcepacks\ResourcePackType;
|
||||
|
||||
class ResourcePackDataInfoPacket extends DataPacket implements ClientboundPacket{
|
||||
@ -56,7 +56,7 @@ class ResourcePackDataInfoPacket extends DataPacket implements ClientboundPacket
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->packId = $in->getString();
|
||||
$this->maxChunkSize = $in->getLInt();
|
||||
$this->chunkCount = $in->getLInt();
|
||||
@ -66,7 +66,7 @@ class ResourcePackDataInfoPacket extends DataPacket implements ClientboundPacket
|
||||
$this->packType = $in->getByte();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->packId);
|
||||
$out->putLInt($this->maxChunkSize);
|
||||
$out->putLInt($this->chunkCount);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\resourcepacks\ResourcePackStackEntry;
|
||||
use function count;
|
||||
|
||||
@ -60,7 +60,7 @@ class ResourcePackStackPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->mustAccept = $in->getBool();
|
||||
$behaviorPackCount = $in->getUnsignedVarInt();
|
||||
while($behaviorPackCount-- > 0){
|
||||
@ -76,7 +76,7 @@ class ResourcePackStackPacket extends DataPacket implements ClientboundPacket{
|
||||
$this->baseGameVersion = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBool($this->mustAccept);
|
||||
|
||||
$out->putUnsignedVarInt(count($this->behaviorPackStack));
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\types\resourcepacks\ResourcePackInfoEntry;
|
||||
use function count;
|
||||
|
||||
@ -56,7 +56,7 @@ class ResourcePacksInfoPacket extends DataPacket implements ClientboundPacket{
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->mustAccept = $in->getBool();
|
||||
$this->hasScripts = $in->getBool();
|
||||
$behaviorPackCount = $in->getLShort();
|
||||
@ -70,7 +70,7 @@ class ResourcePacksInfoPacket extends DataPacket implements ClientboundPacket{
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putBool($this->mustAccept);
|
||||
$out->putBool($this->hasScripts);
|
||||
$out->putLShort(count($this->behaviorPackEntries));
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class RespawnPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::RESPAWN_PACKET;
|
||||
@ -50,13 +50,13 @@ class RespawnPacket extends DataPacket implements ClientboundPacket, Serverbound
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->position = $in->getVector3();
|
||||
$this->respawnState = $in->getByte();
|
||||
$this->entityRuntimeId = $in->getEntityRuntimeId();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVector3($this->position);
|
||||
$out->putByte($this->respawnState);
|
||||
$out->putEntityRuntimeId($this->entityRuntimeId);
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class RiderJumpPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::RIDER_JUMP_PACKET;
|
||||
@ -33,11 +33,11 @@ class RiderJumpPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $jumpStrength; //percentage
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->jumpStrength = $in->getVarInt();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putVarInt($this->jumpStrength);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
|
||||
class ScriptCustomEventPacket extends DataPacket{ //TODO: this doesn't have handlers in either client or server in the game as of 1.8
|
||||
public const NETWORK_ID = ProtocolInfo::SCRIPT_CUSTOM_EVENT_PACKET;
|
||||
@ -35,12 +35,12 @@ class ScriptCustomEventPacket extends DataPacket{ //TODO: this doesn't have hand
|
||||
/** @var string json data */
|
||||
public $eventData;
|
||||
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->eventName = $in->getString();
|
||||
$this->eventData = $in->getString();
|
||||
}
|
||||
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
protected function encodePayload(PacketSerializer $out) : void{
|
||||
$out->putString($this->eventName);
|
||||
$out->putString($this->eventData);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user