Rename NetworkBinaryStream -> PacketSerializer

This commit is contained in:
Dylan K. Taylor 2020-06-17 11:31:13 +01:00
parent c6557f0222
commit 6c096c44aa
176 changed files with 575 additions and 564 deletions

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class ActorEventPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::ACTOR_EVENT_PACKET; public const NETWORK_ID = ProtocolInfo::ACTOR_EVENT_PACKET;
@ -105,13 +105,13 @@ class ActorEventPacket extends DataPacket implements ClientboundPacket, Serverbo
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->event = $in->getByte(); $this->event = $in->getByte();
$this->data = $in->getVarInt(); $this->data = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putByte($this->event); $out->putByte($this->event);
$out->putVarInt($this->data); $out->putVarInt($this->data);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ActorFallPacket extends DataPacket implements ServerboundPacket{ class ActorFallPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::ACTOR_FALL_PACKET; public const NETWORK_ID = ProtocolInfo::ACTOR_FALL_PACKET;
@ -37,13 +37,13 @@ class ActorFallPacket extends DataPacket implements ServerboundPacket{
/** @var bool */ /** @var bool */
public $isInVoid; public $isInVoid;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->fallDistance = $in->getLFloat(); $this->fallDistance = $in->getLFloat();
$this->isInVoid = $in->getBool(); $this->isInVoid = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putLFloat($this->fallDistance); $out->putLFloat($this->fallDistance);
$out->putBool($this->isInVoid); $out->putBool($this->isInVoid);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ActorPickRequestPacket extends DataPacket implements ServerboundPacket{ class ActorPickRequestPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::ACTOR_PICK_REQUEST_PACKET; public const NETWORK_ID = ProtocolInfo::ACTOR_PICK_REQUEST_PACKET;
@ -35,12 +35,12 @@ class ActorPickRequestPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $hotbarSlot; public $hotbarSlot;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityUniqueId = $in->getLLong(); $this->entityUniqueId = $in->getLLong();
$this->hotbarSlot = $in->getByte(); $this->hotbarSlot = $in->getByte();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putLLong($this->entityUniqueId); $out->putLLong($this->entityUniqueId);
$out->putByte($this->hotbarSlot); $out->putByte($this->hotbarSlot);
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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\Attribute;
use pocketmine\network\mcpe\protocol\types\entity\EntityLink; use pocketmine\network\mcpe\protocol\types\entity\EntityLink;
use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty; use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty;
@ -62,7 +62,7 @@ class AddActorPacket extends DataPacket implements ClientboundPacket{
/** @var EntityLink[] */ /** @var EntityLink[] */
public $links = []; public $links = [];
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityUniqueId = $in->getEntityUniqueId(); $this->entityUniqueId = $in->getEntityUniqueId();
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->type = $in->getString(); $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->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putString($this->type); $out->putString($this->type);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class AddBehaviorTreePacket extends DataPacket implements ClientboundPacket{ class AddBehaviorTreePacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::ADD_BEHAVIOR_TREE_PACKET; public const NETWORK_ID = ProtocolInfo::ADD_BEHAVIOR_TREE_PACKET;
@ -33,11 +33,11 @@ class AddBehaviorTreePacket extends DataPacket implements ClientboundPacket{
/** @var string */ /** @var string */
public $behaviorTreeJson; public $behaviorTreeJson;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->behaviorTreeJson = $in->getString(); $this->behaviorTreeJson = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->behaviorTreeJson); $out->putString($this->behaviorTreeJson);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class AddEntityPacket extends DataPacket implements ClientboundPacket{ class AddEntityPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET; public const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET;
@ -43,11 +43,11 @@ class AddEntityPacket extends DataPacket implements ClientboundPacket{
return $this->uvarint1; return $this->uvarint1;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->uvarint1 = $in->getUnsignedVarInt(); $this->uvarint1 = $in->getUnsignedVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->uvarint1); $out->putUnsignedVarInt($this->uvarint1);
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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\entity\MetadataProperty;
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack; use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
@ -51,7 +51,7 @@ class AddItemActorPacket extends DataPacket implements ClientboundPacket{
/** @var bool */ /** @var bool */
public $isFromFishing = false; public $isFromFishing = false;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityUniqueId = $in->getEntityUniqueId(); $this->entityUniqueId = $in->getEntityUniqueId();
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->item = $in->getSlot(); $this->item = $in->getSlot();
@ -61,7 +61,7 @@ class AddItemActorPacket extends DataPacket implements ClientboundPacket{
$this->isFromFishing = $in->getBool(); $this->isFromFishing = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId); $out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putSlot($this->item); $out->putSlot($this->item);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class AddPaintingPacket extends DataPacket implements ClientboundPacket{ class AddPaintingPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::ADD_PAINTING_PACKET; public const NETWORK_ID = ProtocolInfo::ADD_PAINTING_PACKET;
@ -42,7 +42,7 @@ class AddPaintingPacket extends DataPacket implements ClientboundPacket{
/** @var string */ /** @var string */
public $title; public $title;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityUniqueId = $in->getEntityUniqueId(); $this->entityUniqueId = $in->getEntityUniqueId();
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
@ -50,7 +50,7 @@ class AddPaintingPacket extends DataPacket implements ClientboundPacket{
$this->title = $in->getString(); $this->title = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId); $out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putVector3($this->position); $out->putVector3($this->position);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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\DeviceOS;
use pocketmine\network\mcpe\protocol\types\entity\EntityLink; use pocketmine\network\mcpe\protocol\types\entity\EntityLink;
use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty; use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty;
@ -88,7 +88,7 @@ class AddPlayerPacket extends DataPacket implements ClientboundPacket{
/** @var int */ /** @var int */
public $buildPlatform = DeviceOS::UNKNOWN; public $buildPlatform = DeviceOS::UNKNOWN;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->uuid = $in->getUUID(); $this->uuid = $in->getUUID();
$this->username = $in->getString(); $this->username = $in->getString();
$this->entityUniqueId = $in->getEntityUniqueId(); $this->entityUniqueId = $in->getEntityUniqueId();
@ -119,7 +119,7 @@ class AddPlayerPacket extends DataPacket implements ClientboundPacket{
$this->buildPlatform = $in->getLInt(); $this->buildPlatform = $in->getLInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUUID($this->uuid); $out->putUUID($this->uuid);
$out->putString($this->username); $out->putString($this->username);
$out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId); $out->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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; use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
class AdventureSettingsPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ class AdventureSettingsPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
@ -75,7 +75,7 @@ class AdventureSettingsPacket extends DataPacket implements ClientboundPacket, S
/** @var int */ /** @var int */
public $entityUniqueId; //This is a little-endian long, NOT a var-long. (WTF Mojang) 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->flags = $in->getUnsignedVarInt();
$this->commandPermission = $in->getUnsignedVarInt(); $this->commandPermission = $in->getUnsignedVarInt();
$this->flags2 = $in->getUnsignedVarInt(); $this->flags2 = $in->getUnsignedVarInt();
@ -84,7 +84,7 @@ class AdventureSettingsPacket extends DataPacket implements ClientboundPacket, S
$this->entityUniqueId = $in->getLLong(); $this->entityUniqueId = $in->getLLong();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->flags); $out->putUnsignedVarInt($this->flags);
$out->putUnsignedVarInt($this->commandPermission); $out->putUnsignedVarInt($this->commandPermission);
$out->putUnsignedVarInt($this->flags2); $out->putUnsignedVarInt($this->flags2);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class AnimatePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::ANIMATE_PACKET; public const NETWORK_ID = ProtocolInfo::ANIMATE_PACKET;
@ -58,7 +58,7 @@ class AnimatePacket extends DataPacket implements ClientboundPacket, Serverbound
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->action = $in->getVarInt(); $this->action = $in->getVarInt();
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
if(($this->action & 0x80) !== 0){ 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->putVarInt($this->action);
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
if(($this->action & 0x80) !== 0){ if(($this->action & 0x80) !== 0){

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class AnvilDamagePacket extends DataPacket implements ServerboundPacket{ class AnvilDamagePacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::ANVIL_DAMAGE_PACKET; public const NETWORK_ID = ProtocolInfo::ANVIL_DAMAGE_PACKET;
@ -62,12 +62,12 @@ class AnvilDamagePacket extends DataPacket implements ServerboundPacket{
return $this->z; return $this->z;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->damageAmount = $in->getByte(); $this->damageAmount = $in->getByte();
$in->getBlockPosition($this->x, $this->y, $this->z); $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->putByte($this->damageAmount);
$out->putBlockPosition($this->x, $this->y, $this->z); $out->putBlockPosition($this->x, $this->y, $this->z);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class AutomationClientConnectPacket extends DataPacket implements ClientboundPacket{ class AutomationClientConnectPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::AUTOMATION_CLIENT_CONNECT_PACKET; public const NETWORK_ID = ProtocolInfo::AUTOMATION_CLIENT_CONNECT_PACKET;
@ -33,11 +33,11 @@ class AutomationClientConnectPacket extends DataPacket implements ClientboundPac
/** @var string */ /** @var string */
public $serverUri; public $serverUri;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->serverUri = $in->getString(); $this->serverUri = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->serverUri); $out->putString($this->serverUri);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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; use pocketmine\network\mcpe\protocol\types\CacheableNbt;
class AvailableActorIdentifiersPacket extends DataPacket implements ClientboundPacket{ class AvailableActorIdentifiersPacket extends DataPacket implements ClientboundPacket{
@ -46,11 +46,11 @@ class AvailableActorIdentifiersPacket extends DataPacket implements ClientboundP
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->identifiers = new CacheableNbt($in->getNbtCompoundRoot()); $this->identifiers = new CacheableNbt($in->getNbtCompoundRoot());
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->put($this->identifiers->getEncodedNbt()); $out->put($this->identifiers->getEncodedNbt());
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\CommandData;
use pocketmine\network\mcpe\protocol\types\command\CommandEnum; use pocketmine\network\mcpe\protocol\types\command\CommandEnum;
use pocketmine\network\mcpe\protocol\types\command\CommandEnumConstraint; use pocketmine\network\mcpe\protocol\types\command\CommandEnumConstraint;
@ -108,7 +108,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
*/ */
public $enumConstraints = []; public $enumConstraints = [];
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
/** @var string[] $enumValues */ /** @var string[] $enumValues */
$enumValues = []; $enumValues = [];
for($i = 0, $enumValuesCount = $in->getUnsignedVarInt(); $i < $enumValuesCount; ++$i){ for($i = 0, $enumValuesCount = $in->getUnsignedVarInt(); $i < $enumValuesCount; ++$i){
@ -149,7 +149,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
* @throws PacketDecodeException * @throws PacketDecodeException
* @throws BinaryDataException * @throws BinaryDataException
*/ */
protected function getEnum(array $enumValueList, NetworkBinaryStream $in) : CommandEnum{ protected function getEnum(array $enumValueList, PacketSerializer $in) : CommandEnum{
$enumName = $in->getString(); $enumName = $in->getString();
$enumValues = []; $enumValues = [];
@ -170,7 +170,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
/** /**
* @throws BinaryDataException * @throws BinaryDataException
*/ */
protected function getSoftEnum(NetworkBinaryStream $in) : CommandEnum{ protected function getSoftEnum(PacketSerializer $in) : CommandEnum{
$enumName = $in->getString(); $enumName = $in->getString();
$enumValues = []; $enumValues = [];
@ -185,7 +185,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
/** /**
* @param int[] $enumValueMap * @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()); $out->putString($enum->getName());
$values = $enum->getValues(); $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()); $out->putString($enum->getName());
$values = $enum->getValues(); $values = $enum->getValues();
@ -213,7 +213,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
/** /**
* @throws BinaryDataException * @throws BinaryDataException
*/ */
protected function getEnumValueIndex(int $valueCount, NetworkBinaryStream $in) : int{ protected function getEnumValueIndex(int $valueCount, PacketSerializer $in) : int{
if($valueCount < 256){ if($valueCount < 256){
return $in->getByte(); return $in->getByte();
}elseif($valueCount < 65536){ }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){ if($valueCount < 256){
$out->putByte($index); $out->putByte($index);
}elseif($valueCount < 65536){ }elseif($valueCount < 65536){
@ -240,7 +240,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
* @throws PacketDecodeException * @throws PacketDecodeException
* @throws BinaryDataException * @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? :( //wtf, what was wrong with an offset inside the enum? :(
$valueIndex = $in->getLInt(); $valueIndex = $in->getLInt();
if(!isset($enumValues[$valueIndex])){ if(!isset($enumValues[$valueIndex])){
@ -268,7 +268,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
* @param int[] $enumIndexes string enum name -> int index * @param int[] $enumIndexes string enum name -> int index
* @param int[] $enumValueIndexes string value -> 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($enumValueIndexes[$constraint->getAffectedValue()]);
$out->putLInt($enumIndexes[$constraint->getEnum()->getName()]); $out->putLInt($enumIndexes[$constraint->getEnum()->getName()]);
$out->putUnsignedVarInt(count($constraint->getConstraints())); $out->putUnsignedVarInt(count($constraint->getConstraints()));
@ -284,7 +284,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
* @throws PacketDecodeException * @throws PacketDecodeException
* @throws BinaryDataException * @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(); $name = $in->getString();
$description = $in->getString(); $description = $in->getString();
$flags = $in->getByte(); $flags = $in->getByte();
@ -328,7 +328,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
* @param int[] $enumIndexes string enum name -> int index * @param int[] $enumIndexes string enum name -> int index
* @param int[] $postfixIndexes * @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->name);
$out->putString($data->description); $out->putString($data->description);
$out->putByte($data->flags); $out->putByte($data->flags);
@ -409,7 +409,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
return "unknown ($argtype)"; return "unknown ($argtype)";
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
/** @var int[] $enumValueIndexes */ /** @var int[] $enumValueIndexes */
$enumValueIndexes = []; $enumValueIndexes = [];
/** @var int[] $postfixIndexes */ /** @var int[] $postfixIndexes */

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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; use pocketmine\network\mcpe\protocol\types\CacheableNbt;
class BiomeDefinitionListPacket extends DataPacket implements ClientboundPacket{ class BiomeDefinitionListPacket extends DataPacket implements ClientboundPacket{
@ -46,11 +46,11 @@ class BiomeDefinitionListPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->defs = new CacheableNbt($in->getNbtCompoundRoot()); $this->defs = new CacheableNbt($in->getNbtCompoundRoot());
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->put($this->defs->getEncodedNbt()); $out->put($this->defs->getEncodedNbt());
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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; use pocketmine\network\mcpe\protocol\types\CacheableNbt;
class BlockActorDataPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ class BlockActorDataPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
@ -53,12 +53,12 @@ class BlockActorDataPacket extends DataPacket implements ClientboundPacket, Serv
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$in->getBlockPosition($this->x, $this->y, $this->z); $in->getBlockPosition($this->x, $this->y, $this->z);
$this->namedtag = new CacheableNbt($in->getNbtCompoundRoot()); $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->putBlockPosition($this->x, $this->y, $this->z);
$out->put($this->namedtag->getEncodedNbt()); $out->put($this->namedtag->getEncodedNbt());
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class BlockEventPacket extends DataPacket implements ClientboundPacket{ class BlockEventPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::BLOCK_EVENT_PACKET; public const NETWORK_ID = ProtocolInfo::BLOCK_EVENT_PACKET;
@ -52,13 +52,13 @@ class BlockEventPacket extends DataPacket implements ClientboundPacket{
return $pk; return $pk;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$in->getBlockPosition($this->x, $this->y, $this->z); $in->getBlockPosition($this->x, $this->y, $this->z);
$this->eventType = $in->getVarInt(); $this->eventType = $in->getVarInt();
$this->eventData = $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->putBlockPosition($this->x, $this->y, $this->z);
$out->putVarInt($this->eventType); $out->putVarInt($this->eventType);
$out->putVarInt($this->eventData); $out->putVarInt($this->eventData);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class BlockPickRequestPacket extends DataPacket implements ServerboundPacket{ class BlockPickRequestPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::BLOCK_PICK_REQUEST_PACKET; public const NETWORK_ID = ProtocolInfo::BLOCK_PICK_REQUEST_PACKET;
@ -41,13 +41,13 @@ class BlockPickRequestPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $hotbarSlot; public $hotbarSlot;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$in->getSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ); $in->getSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
$this->addUserData = $in->getBool(); $this->addUserData = $in->getBool();
$this->hotbarSlot = $in->getByte(); $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->putSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
$out->putBool($this->addUserData); $out->putBool($this->addUserData);
$out->putByte($this->hotbarSlot); $out->putByte($this->hotbarSlot);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class BookEditPacket extends DataPacket implements ServerboundPacket{ class BookEditPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::BOOK_EDIT_PACKET; public const NETWORK_ID = ProtocolInfo::BOOK_EDIT_PACKET;
@ -57,7 +57,7 @@ class BookEditPacket extends DataPacket implements ServerboundPacket{
/** @var string */ /** @var string */
public $xuid; public $xuid;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->type = $in->getByte(); $this->type = $in->getByte();
$this->inventorySlot = $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->type);
$out->putByte($this->inventorySlot); $out->putByte($this->inventorySlot);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class BossEventPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::BOSS_EVENT_PACKET; public const NETWORK_ID = ProtocolInfo::BOSS_EVENT_PACKET;
@ -118,7 +118,7 @@ class BossEventPacket extends DataPacket implements ClientboundPacket, Serverbou
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->bossEid = $in->getEntityUniqueId(); $this->bossEid = $in->getEntityUniqueId();
$this->eventType = $in->getUnsignedVarInt(); $this->eventType = $in->getUnsignedVarInt();
switch($this->eventType){ 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->putEntityUniqueId($this->bossEid);
$out->putUnsignedVarInt($this->eventType); $out->putUnsignedVarInt($this->eventType);
switch($this->eventType){ switch($this->eventType){

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class CameraPacket extends DataPacket implements ClientboundPacket{ class CameraPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::CAMERA_PACKET; public const NETWORK_ID = ProtocolInfo::CAMERA_PACKET;
@ -35,12 +35,12 @@ class CameraPacket extends DataPacket implements ClientboundPacket{
/** @var int */ /** @var int */
public $playerUniqueId; public $playerUniqueId;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->cameraUniqueId = $in->getEntityUniqueId(); $this->cameraUniqueId = $in->getEntityUniqueId();
$this->playerUniqueId = $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->cameraUniqueId);
$out->putEntityUniqueId($this->playerUniqueId); $out->putEntityUniqueId($this->playerUniqueId);
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ChangeDimensionPacket extends DataPacket implements ClientboundPacket{ class ChangeDimensionPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::CHANGE_DIMENSION_PACKET; public const NETWORK_ID = ProtocolInfo::CHANGE_DIMENSION_PACKET;
@ -38,13 +38,13 @@ class ChangeDimensionPacket extends DataPacket implements ClientboundPacket{
/** @var bool */ /** @var bool */
public $respawn = false; public $respawn = false;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->dimension = $in->getVarInt(); $this->dimension = $in->getVarInt();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
$this->respawn = $in->getBool(); $this->respawn = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->dimension); $out->putVarInt($this->dimension);
$out->putVector3($this->position); $out->putVector3($this->position);
$out->putBool($this->respawn); $out->putBool($this->respawn);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ChunkRadiusUpdatedPacket extends DataPacket implements ClientboundPacket{ class ChunkRadiusUpdatedPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::CHUNK_RADIUS_UPDATED_PACKET; public const NETWORK_ID = ProtocolInfo::CHUNK_RADIUS_UPDATED_PACKET;
@ -39,11 +39,11 @@ class ChunkRadiusUpdatedPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->radius = $in->getVarInt(); $this->radius = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->radius); $out->putVarInt($this->radius);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use function count; use function count;
class ClientCacheBlobStatusPacket extends DataPacket implements ServerboundPacket{ class ClientCacheBlobStatusPacket extends DataPacket implements ServerboundPacket{
@ -65,7 +65,7 @@ class ClientCacheBlobStatusPacket extends DataPacket implements ServerboundPacke
return $this->missHashes; return $this->missHashes;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$hitCount = $in->getUnsignedVarInt(); $hitCount = $in->getUnsignedVarInt();
$missCount = $in->getUnsignedVarInt(); $missCount = $in->getUnsignedVarInt();
for($i = 0; $i < $hitCount; ++$i){ 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->hitHashes));
$out->putUnsignedVarInt(count($this->missHashes)); $out->putUnsignedVarInt(count($this->missHashes));
foreach($this->hitHashes as $hash){ foreach($this->hitHashes as $hash){

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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 pocketmine\network\mcpe\protocol\types\ChunkCacheBlob;
use function count; use function count;
@ -54,7 +54,7 @@ class ClientCacheMissResponsePacket extends DataPacket implements ClientboundPac
return $this->blobs; return $this->blobs;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
for($i = 0, $count = $in->getUnsignedVarInt(); $i < $count; ++$i){ for($i = 0, $count = $in->getUnsignedVarInt(); $i < $count; ++$i){
$hash = $in->getLLong(); $hash = $in->getLLong();
$payload = $in->getString(); $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)); $out->putUnsignedVarInt(count($this->blobs));
foreach($this->blobs as $blob){ foreach($this->blobs as $blob){
$out->putLLong($blob->getHash()); $out->putLLong($blob->getHash());

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ClientCacheStatusPacket extends DataPacket implements ServerboundPacket{ class ClientCacheStatusPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::CLIENT_CACHE_STATUS_PACKET; public const NETWORK_ID = ProtocolInfo::CLIENT_CACHE_STATUS_PACKET;
@ -43,11 +43,11 @@ class ClientCacheStatusPacket extends DataPacket implements ServerboundPacket{
return $this->enabled; return $this->enabled;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->enabled = $in->getBool(); $this->enabled = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putBool($this->enabled); $out->putBool($this->enabled);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ClientToServerHandshakePacket extends DataPacket implements ServerboundPacket{ class ClientToServerHandshakePacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::CLIENT_TO_SERVER_HANDSHAKE_PACKET; public const NETWORK_ID = ProtocolInfo::CLIENT_TO_SERVER_HANDSHAKE_PACKET;
@ -34,11 +34,11 @@ class ClientToServerHandshakePacket extends DataPacket implements ServerboundPac
return true; return true;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
//No payload //No payload
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
//No payload //No payload
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\color\Color; 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\DimensionIds;
use pocketmine\network\mcpe\protocol\types\MapDecoration; use pocketmine\network\mcpe\protocol\types\MapDecoration;
use pocketmine\network\mcpe\protocol\types\MapTrackedObject; use pocketmine\network\mcpe\protocol\types\MapTrackedObject;
@ -71,7 +71,7 @@ class ClientboundMapItemDataPacket extends DataPacket implements ClientboundPack
/** @var Color[][] */ /** @var Color[][] */
public $colors = []; public $colors = [];
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->mapId = $in->getEntityUniqueId(); $this->mapId = $in->getEntityUniqueId();
$this->type = $in->getUnsignedVarInt(); $this->type = $in->getUnsignedVarInt();
$this->dimensionId = $in->getByte(); $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); $out->putEntityUniqueId($this->mapId);
$type = 0; $type = 0;

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class CommandBlockUpdatePacket extends DataPacket implements ServerboundPacket{ class CommandBlockUpdatePacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET; public const NETWORK_ID = ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET;
@ -62,7 +62,7 @@ class CommandBlockUpdatePacket extends DataPacket implements ServerboundPacket{
/** @var bool */ /** @var bool */
public $executeOnFirstTick; public $executeOnFirstTick;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->isBlock = $in->getBool(); $this->isBlock = $in->getBool();
if($this->isBlock){ if($this->isBlock){
@ -84,7 +84,7 @@ class CommandBlockUpdatePacket extends DataPacket implements ServerboundPacket{
$this->executeOnFirstTick = $in->getBool(); $this->executeOnFirstTick = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putBool($this->isBlock); $out->putBool($this->isBlock);
if($this->isBlock){ if($this->isBlock){

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\CommandOriginData;
use pocketmine\network\mcpe\protocol\types\command\CommandOutputMessage; use pocketmine\network\mcpe\protocol\types\command\CommandOutputMessage;
use pocketmine\utils\BinaryDataException; use pocketmine\utils\BinaryDataException;
@ -45,7 +45,7 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
/** @var string */ /** @var string */
public $unknownString; public $unknownString;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->originData = $in->getCommandOriginData(); $this->originData = $in->getCommandOriginData();
$this->outputType = $in->getByte(); $this->outputType = $in->getByte();
$this->successCount = $in->getUnsignedVarInt(); $this->successCount = $in->getUnsignedVarInt();
@ -62,7 +62,7 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
/** /**
* @throws BinaryDataException * @throws BinaryDataException
*/ */
protected function getCommandMessage(NetworkBinaryStream $in) : CommandOutputMessage{ protected function getCommandMessage(PacketSerializer $in) : CommandOutputMessage{
$message = new CommandOutputMessage(); $message = new CommandOutputMessage();
$message->isInternal = $in->getBool(); $message->isInternal = $in->getBool();
@ -75,7 +75,7 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
return $message; return $message;
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putCommandOriginData($this->originData); $out->putCommandOriginData($this->originData);
$out->putByte($this->outputType); $out->putByte($this->outputType);
$out->putUnsignedVarInt($this->successCount); $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->putBool($message->isInternal);
$out->putString($message->messageId); $out->putString($message->messageId);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\CommandOriginData;
class CommandRequestPacket extends DataPacket implements ServerboundPacket{ class CommandRequestPacket extends DataPacket implements ServerboundPacket{
@ -38,13 +38,13 @@ class CommandRequestPacket extends DataPacket implements ServerboundPacket{
/** @var bool */ /** @var bool */
public $isInternal; public $isInternal;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->command = $in->getString(); $this->command = $in->getString();
$this->originData = $in->getCommandOriginData(); $this->originData = $in->getCommandOriginData();
$this->isInternal = $in->getBool(); $this->isInternal = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->command); $out->putString($this->command);
$out->putCommandOriginData($this->originData); $out->putCommandOriginData($this->originData);
$out->putBool($this->isInternal); $out->putBool($this->isInternal);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class CompletedUsingItemPacket extends DataPacket implements ClientboundPacket{ class CompletedUsingItemPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::COMPLETED_USING_ITEM_PACKET; public const NETWORK_ID = ProtocolInfo::COMPLETED_USING_ITEM_PACKET;
@ -52,12 +52,12 @@ class CompletedUsingItemPacket extends DataPacket implements ClientboundPacket{
/** @var int */ /** @var int */
public $action; public $action;
public function decodePayload(NetworkBinaryStream $in) : void{ public function decodePayload(PacketSerializer $in) : void{
$this->itemId = $in->getShort(); $this->itemId = $in->getShort();
$this->action = $in->getLInt(); $this->action = $in->getLInt();
} }
public function encodePayload(NetworkBinaryStream $out) : void{ public function encodePayload(PacketSerializer $out) : void{
$out->putShort($this->itemId); $out->putShort($this->itemId);
$out->putLInt($this->action); $out->putLInt($this->action);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class ContainerClosePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::CONTAINER_CLOSE_PACKET; public const NETWORK_ID = ProtocolInfo::CONTAINER_CLOSE_PACKET;
@ -39,11 +39,11 @@ class ContainerClosePacket extends DataPacket implements ClientboundPacket, Serv
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->windowId = $in->getByte(); $this->windowId = $in->getByte();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->windowId); $out->putByte($this->windowId);
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ContainerOpenPacket extends DataPacket implements ClientboundPacket{ class ContainerOpenPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::CONTAINER_OPEN_PACKET; public const NETWORK_ID = ProtocolInfo::CONTAINER_OPEN_PACKET;
@ -65,14 +65,14 @@ class ContainerOpenPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->windowId = $in->getByte(); $this->windowId = $in->getByte();
$this->type = $in->getByte(); $this->type = $in->getByte();
$in->getBlockPosition($this->x, $this->y, $this->z); $in->getBlockPosition($this->x, $this->y, $this->z);
$this->entityUniqueId = $in->getEntityUniqueId(); $this->entityUniqueId = $in->getEntityUniqueId();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->windowId); $out->putByte($this->windowId);
$out->putByte($this->type); $out->putByte($this->type);
$out->putBlockPosition($this->x, $this->y, $this->z); $out->putBlockPosition($this->x, $this->y, $this->z);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ContainerSetDataPacket extends DataPacket implements ClientboundPacket{ class ContainerSetDataPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::CONTAINER_SET_DATA_PACKET; public const NETWORK_ID = ProtocolInfo::CONTAINER_SET_DATA_PACKET;
@ -55,13 +55,13 @@ class ContainerSetDataPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->windowId = $in->getByte(); $this->windowId = $in->getByte();
$this->property = $in->getVarInt(); $this->property = $in->getVarInt();
$this->value = $in->getVarInt(); $this->value = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->windowId); $out->putByte($this->windowId);
$out->putVarInt($this->property); $out->putVarInt($this->property);
$out->putVarInt($this->value); $out->putVarInt($this->value);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\PotionContainerChangeRecipe;
use pocketmine\network\mcpe\protocol\types\PotionTypeRecipe; use pocketmine\network\mcpe\protocol\types\PotionTypeRecipe;
use pocketmine\network\mcpe\protocol\types\recipe\FurnaceRecipe; use pocketmine\network\mcpe\protocol\types\recipe\FurnaceRecipe;
@ -56,7 +56,7 @@ class CraftingDataPacket extends DataPacket implements ClientboundPacket{
/** @var bool */ /** @var bool */
public $cleanRecipes = false; public $cleanRecipes = false;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$recipeCount = $in->getUnsignedVarInt(); $recipeCount = $in->getUnsignedVarInt();
for($i = 0; $i < $recipeCount; ++$i){ for($i = 0; $i < $recipeCount; ++$i){
$recipeType = $in->getVarInt(); $recipeType = $in->getVarInt();
@ -97,7 +97,7 @@ class CraftingDataPacket extends DataPacket implements ClientboundPacket{
$this->cleanRecipes = $in->getBool(); $this->cleanRecipes = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt(count($this->entries)); $out->putUnsignedVarInt(count($this->entries));
foreach($this->entries as $d){ foreach($this->entries as $d){
$out->putVarInt($d->getTypeId()); $out->putVarInt($d->getTypeId());

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\network\mcpe\protocol\types\inventory\ItemStack;
use pocketmine\uuid\UUID; use pocketmine\uuid\UUID;
use function count; use function count;
@ -44,7 +44,7 @@ class CraftingEventPacket extends DataPacket implements ServerboundPacket{
/** @var ItemStack[] */ /** @var ItemStack[] */
public $output = []; public $output = [];
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->windowId = $in->getByte(); $this->windowId = $in->getByte();
$this->type = $in->getVarInt(); $this->type = $in->getVarInt();
$this->id = $in->getUUID(); $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->putByte($this->windowId);
$out->putVarInt($this->type); $out->putVarInt($this->type);
$out->putUUID($this->id); $out->putUUID($this->id);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use pocketmine\utils\BinaryDataException; use pocketmine\utils\BinaryDataException;
use function get_class; use function get_class;
@ -44,14 +44,14 @@ abstract class DataPacket implements Packet{
/** @var int */ /** @var int */
public $recipientSubId = 0; public $recipientSubId = 0;
/** @var NetworkBinaryStream */ /** @var PacketSerializer */
private $buf; private $buf;
public function __construct(){ public function __construct(){
$this->buf = new NetworkBinaryStream(); $this->buf = new PacketSerializer();
} }
public function getBinaryStream() : NetworkBinaryStream{ public function getBinaryStream() : PacketSerializer{
return $this->buf; return $this->buf;
} }
@ -84,7 +84,7 @@ abstract class DataPacket implements Packet{
* @throws BinaryDataException * @throws BinaryDataException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
protected function decodeHeader(NetworkBinaryStream $in) : void{ protected function decodeHeader(PacketSerializer $in) : void{
$header = $in->getUnsignedVarInt(); $header = $in->getUnsignedVarInt();
$pid = $header & self::PID_MASK; $pid = $header & self::PID_MASK;
if($pid !== static::NETWORK_ID){ if($pid !== static::NETWORK_ID){
@ -102,7 +102,7 @@ abstract class DataPacket implements Packet{
* @throws PacketDecodeException * @throws PacketDecodeException
* @throws BinaryDataException * @throws BinaryDataException
*/ */
abstract protected function decodePayload(NetworkBinaryStream $in) : void; abstract protected function decodePayload(PacketSerializer $in) : void;
final public function encode() : void{ final public function encode() : void{
$this->buf->reset(); $this->buf->reset();
@ -110,7 +110,7 @@ abstract class DataPacket implements Packet{
$this->encodePayload($this->buf); $this->encodePayload($this->buf);
} }
protected function encodeHeader(NetworkBinaryStream $out) : void{ protected function encodeHeader(PacketSerializer $out) : void{
$out->putUnsignedVarInt( $out->putUnsignedVarInt(
static::NETWORK_ID | static::NETWORK_ID |
($this->senderSubId << self::SENDER_SUBCLIENT_ID_SHIFT) | ($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. * 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 * @param string $name

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class DisconnectPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::DISCONNECT_PACKET; public const NETWORK_ID = ProtocolInfo::DISCONNECT_PACKET;
@ -52,14 +52,14 @@ class DisconnectPacket extends DataPacket implements ClientboundPacket, Serverbo
return true; return true;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->hideDisconnectionScreen = $in->getBool(); $this->hideDisconnectionScreen = $in->getBool();
if(!$this->hideDisconnectionScreen){ if(!$this->hideDisconnectionScreen){
$this->message = $in->getString(); $this->message = $in->getString();
} }
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putBool($this->hideDisconnectionScreen); $out->putBool($this->hideDisconnectionScreen);
if(!$this->hideDisconnectionScreen){ if(!$this->hideDisconnectionScreen){
$out->putString($this->message); $out->putString($this->message);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class EducationSettingsPacket extends DataPacket implements ClientboundPacket{ class EducationSettingsPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::EDUCATION_SETTINGS_PACKET; public const NETWORK_ID = ProtocolInfo::EDUCATION_SETTINGS_PACKET;
@ -50,12 +50,12 @@ class EducationSettingsPacket extends DataPacket implements ClientboundPacket{
return $this->hasQuiz; return $this->hasQuiz;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->codeBuilderDefaultUri = $in->getString(); $this->codeBuilderDefaultUri = $in->getString();
$this->hasQuiz = $in->getBool(); $this->hasQuiz = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->codeBuilderDefaultUri); $out->putString($this->codeBuilderDefaultUri);
$out->putBool($this->hasQuiz); $out->putBool($this->hasQuiz);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class EmotePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::EMOTE_PACKET; public const NETWORK_ID = ProtocolInfo::EMOTE_PACKET;
@ -62,13 +62,13 @@ class EmotePacket extends DataPacket implements ClientboundPacket, ServerboundPa
return $this->flags; return $this->flags;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->emoteId = $in->getString(); $this->emoteId = $in->getString();
$this->flags = $in->getByte(); $this->flags = $in->getByte();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putString($this->emoteId); $out->putString($this->emoteId);
$out->putByte($this->flags); $out->putByte($this->flags);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class EventPacket extends DataPacket implements ClientboundPacket{ class EventPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::EVENT_PACKET; public const NETWORK_ID = ProtocolInfo::EVENT_PACKET;
@ -56,7 +56,7 @@ class EventPacket extends DataPacket implements ClientboundPacket{
/** @var int */ /** @var int */
public $type; public $type;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->playerRuntimeId = $in->getEntityRuntimeId(); $this->playerRuntimeId = $in->getEntityRuntimeId();
$this->eventData = $in->getVarInt(); $this->eventData = $in->getVarInt();
$this->type = $in->getByte(); $this->type = $in->getByte();
@ -64,7 +64,7 @@ class EventPacket extends DataPacket implements ClientboundPacket{
//TODO: nice confusing mess //TODO: nice confusing mess
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->playerRuntimeId); $out->putEntityRuntimeId($this->playerRuntimeId);
$out->putVarInt($this->eventData); $out->putVarInt($this->eventData);
$out->putByte($this->type); $out->putByte($this->type);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class GameRulesChangedPacket extends DataPacket implements ClientboundPacket{ class GameRulesChangedPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::GAME_RULES_CHANGED_PACKET; public const NETWORK_ID = ProtocolInfo::GAME_RULES_CHANGED_PACKET;
@ -36,11 +36,11 @@ class GameRulesChangedPacket extends DataPacket implements ClientboundPacket{
*/ */
public $gameRules = []; public $gameRules = [];
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->gameRules = $in->getGameRules(); $this->gameRules = $in->getGameRules();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putGameRules($this->gameRules); $out->putGameRules($this->gameRules);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class GuiDataPickItemPacket extends DataPacket implements ClientboundPacket{ class GuiDataPickItemPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::GUI_DATA_PICK_ITEM_PACKET; public const NETWORK_ID = ProtocolInfo::GUI_DATA_PICK_ITEM_PACKET;
@ -37,13 +37,13 @@ class GuiDataPickItemPacket extends DataPacket implements ClientboundPacket{
/** @var int */ /** @var int */
public $hotbarSlot; public $hotbarSlot;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->itemDescription = $in->getString(); $this->itemDescription = $in->getString();
$this->itemEffects = $in->getString(); $this->itemEffects = $in->getString();
$this->hotbarSlot = $in->getLInt(); $this->hotbarSlot = $in->getLInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->itemDescription); $out->putString($this->itemDescription);
$out->putString($this->itemEffects); $out->putString($this->itemEffects);
$out->putLInt($this->hotbarSlot); $out->putLInt($this->hotbarSlot);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class HurtArmorPacket extends DataPacket implements ClientboundPacket{ class HurtArmorPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::HURT_ARMOR_PACKET; public const NETWORK_ID = ProtocolInfo::HURT_ARMOR_PACKET;
@ -33,11 +33,11 @@ class HurtArmorPacket extends DataPacket implements ClientboundPacket{
/** @var int */ /** @var int */
public $health; public $health;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->health = $in->getVarInt(); $this->health = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->health); $out->putVarInt($this->health);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class InteractPacket extends DataPacket implements ServerboundPacket{ class InteractPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::INTERACT_PACKET; public const NETWORK_ID = ProtocolInfo::INTERACT_PACKET;
@ -47,7 +47,7 @@ class InteractPacket extends DataPacket implements ServerboundPacket{
/** @var float */ /** @var float */
public $z; public $z;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->action = $in->getByte(); $this->action = $in->getByte();
$this->target = $in->getEntityRuntimeId(); $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->putByte($this->action);
$out->putEntityRuntimeId($this->target); $out->putEntityRuntimeId($this->target);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\network\mcpe\protocol\types\inventory\ItemStack;
use function count; use function count;
@ -49,7 +49,7 @@ class InventoryContentPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->windowId = $in->getUnsignedVarInt(); $this->windowId = $in->getUnsignedVarInt();
$count = $in->getUnsignedVarInt(); $count = $in->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){ 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($this->windowId);
$out->putUnsignedVarInt(count($this->items)); $out->putUnsignedVarInt(count($this->items));
foreach($this->items as $item){ foreach($this->items as $item){

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\network\mcpe\protocol\types\inventory\ItemStack;
class InventorySlotPacket extends DataPacket implements ClientboundPacket{ class InventorySlotPacket extends DataPacket implements ClientboundPacket{
@ -47,13 +47,13 @@ class InventorySlotPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->windowId = $in->getUnsignedVarInt(); $this->windowId = $in->getUnsignedVarInt();
$this->inventorySlot = $in->getUnsignedVarInt(); $this->inventorySlot = $in->getUnsignedVarInt();
$this->item = $in->getSlot(); $this->item = $in->getSlot();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->windowId); $out->putUnsignedVarInt($this->windowId);
$out->putUnsignedVarInt($this->inventorySlot); $out->putUnsignedVarInt($this->inventorySlot);
$out->putSlot($this->item); $out->putSlot($this->item);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\MismatchTransactionData;
use pocketmine\network\mcpe\protocol\types\inventory\NormalTransactionData; use pocketmine\network\mcpe\protocol\types\inventory\NormalTransactionData;
use pocketmine\network\mcpe\protocol\types\inventory\ReleaseItemTransactionData; use pocketmine\network\mcpe\protocol\types\inventory\ReleaseItemTransactionData;
@ -48,7 +48,7 @@ class InventoryTransactionPacket extends DataPacket implements ClientboundPacket
/** @var TransactionData */ /** @var TransactionData */
public $trData; public $trData;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$transactionType = $in->getUnsignedVarInt(); $transactionType = $in->getUnsignedVarInt();
switch($transactionType){ switch($transactionType){
@ -74,7 +74,7 @@ class InventoryTransactionPacket extends DataPacket implements ClientboundPacket
$this->trData->decode($in); $this->trData->decode($in);
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->trData->getTypeId()); $out->putUnsignedVarInt($this->trData->getTypeId());
$this->trData->encode($out); $this->trData->encode($out);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ItemFrameDropItemPacket extends DataPacket implements ServerboundPacket{ class ItemFrameDropItemPacket extends DataPacket implements ServerboundPacket{
@ -38,11 +38,11 @@ class ItemFrameDropItemPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $z; public $z;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$in->getBlockPosition($this->x, $this->y, $this->z); $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); $out->putBlockPosition($this->x, $this->y, $this->z);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class LabTablePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::LAB_TABLE_PACKET; public const NETWORK_ID = ProtocolInfo::LAB_TABLE_PACKET;
@ -47,13 +47,13 @@ class LabTablePacket extends DataPacket implements ClientboundPacket, Serverboun
/** @var int */ /** @var int */
public $reactionType; public $reactionType;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->type = $in->getByte(); $this->type = $in->getByte();
$in->getSignedBlockPosition($this->x, $this->y, $this->z); $in->getSignedBlockPosition($this->x, $this->y, $this->z);
$this->reactionType = $in->getByte(); $this->reactionType = $in->getByte();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->type); $out->putByte($this->type);
$out->putSignedBlockPosition($this->x, $this->y, $this->z); $out->putSignedBlockPosition($this->x, $this->y, $this->z);
$out->putByte($this->reactionType); $out->putByte($this->reactionType);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class LecternUpdatePacket extends DataPacket implements ServerboundPacket{ class LecternUpdatePacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::LECTERN_UPDATE_PACKET; public const NETWORK_ID = ProtocolInfo::LECTERN_UPDATE_PACKET;
@ -43,14 +43,14 @@ class LecternUpdatePacket extends DataPacket implements ServerboundPacket{
/** @var bool */ /** @var bool */
public $dropBook; public $dropBook;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->page = $in->getByte(); $this->page = $in->getByte();
$this->totalPages = $in->getByte(); $this->totalPages = $in->getByte();
$in->getBlockPosition($this->x, $this->y, $this->z); $in->getBlockPosition($this->x, $this->y, $this->z);
$this->dropBook = $in->getBool(); $this->dropBook = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->page); $out->putByte($this->page);
$out->putByte($this->totalPages); $out->putByte($this->totalPages);
$out->putBlockPosition($this->x, $this->y, $this->z); $out->putBlockPosition($this->x, $this->y, $this->z);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use function count; use function count;
class LevelChunkPacket extends DataPacket implements ClientboundPacket{ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
@ -100,7 +100,7 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
return $this->extraPayload; return $this->extraPayload;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->chunkX = $in->getVarInt(); $this->chunkX = $in->getVarInt();
$this->chunkZ = $in->getVarInt(); $this->chunkZ = $in->getVarInt();
$this->subChunkCount = $in->getUnsignedVarInt(); $this->subChunkCount = $in->getUnsignedVarInt();
@ -113,7 +113,7 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
$this->extraPayload = $in->getString(); $this->extraPayload = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->chunkX); $out->putVarInt($this->chunkX);
$out->putVarInt($this->chunkZ); $out->putVarInt($this->chunkZ);
$out->putUnsignedVarInt($this->subChunkCount); $out->putUnsignedVarInt($this->subChunkCount);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\nbt\tag\CompoundTag; 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; use pocketmine\network\mcpe\protocol\types\CacheableNbt;
class LevelEventGenericPacket extends DataPacket implements ClientboundPacket{ class LevelEventGenericPacket extends DataPacket implements ClientboundPacket{
@ -58,12 +58,12 @@ class LevelEventGenericPacket extends DataPacket implements ClientboundPacket{
return $this->eventData; return $this->eventData;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->eventId = $in->getVarInt(); $this->eventId = $in->getVarInt();
$this->eventData = new CacheableNbt($in->getNbtCompoundRoot()); $this->eventData = new CacheableNbt($in->getNbtCompoundRoot());
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->eventId); $out->putVarInt($this->eventId);
$out->put($this->eventData->getEncodedNbt()); $out->put($this->eventData->getEncodedNbt());
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class LevelEventPacket extends DataPacket implements ClientboundPacket{ class LevelEventPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::LEVEL_EVENT_PACKET; 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); 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->evid = $in->getVarInt();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
$this->data = $in->getVarInt(); $this->data = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->evid); $out->putVarInt($this->evid);
$out->putVector3Nullable($this->position); $out->putVector3Nullable($this->position);
$out->putVarInt($this->data); $out->putVarInt($this->data);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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{ class LevelSoundEventPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::LEVEL_SOUND_EVENT_PACKET; public const NETWORK_ID = ProtocolInfo::LEVEL_SOUND_EVENT_PACKET;
@ -335,7 +335,7 @@ class LevelSoundEventPacket extends DataPacket implements ClientboundPacket, Ser
/** @var bool */ /** @var bool */
public $disableRelativeVolume = false; public $disableRelativeVolume = false;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->sound = $in->getUnsignedVarInt(); $this->sound = $in->getUnsignedVarInt();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
$this->extraData = $in->getVarInt(); $this->extraData = $in->getVarInt();
@ -344,7 +344,7 @@ class LevelSoundEventPacket extends DataPacket implements ClientboundPacket, Ser
$this->disableRelativeVolume = $in->getBool(); $this->disableRelativeVolume = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->sound); $out->putUnsignedVarInt($this->sound);
$out->putVector3($this->position); $out->putVector3($this->position);
$out->putVarInt($this->extraData); $out->putVarInt($this->extraData);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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 * Useless leftover from a 1.8 refactor, does nothing
@ -47,7 +47,7 @@ class LevelSoundEventPacketV1 extends DataPacket{
/** @var bool */ /** @var bool */
public $disableRelativeVolume = false; public $disableRelativeVolume = false;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->sound = $in->getByte(); $this->sound = $in->getByte();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
$this->extraData = $in->getVarInt(); $this->extraData = $in->getVarInt();
@ -56,7 +56,7 @@ class LevelSoundEventPacketV1 extends DataPacket{
$this->disableRelativeVolume = $in->getBool(); $this->disableRelativeVolume = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->sound); $out->putByte($this->sound);
$out->putVector3($this->position); $out->putVector3($this->position);
$out->putVarInt($this->extraData); $out->putVarInt($this->extraData);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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 * Useless leftover from a 1.9 refactor, does nothing
@ -47,7 +47,7 @@ class LevelSoundEventPacketV2 extends DataPacket{
/** @var bool */ /** @var bool */
public $disableRelativeVolume = false; public $disableRelativeVolume = false;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->sound = $in->getByte(); $this->sound = $in->getByte();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
$this->extraData = $in->getVarInt(); $this->extraData = $in->getVarInt();
@ -56,7 +56,7 @@ class LevelSoundEventPacketV2 extends DataPacket{
$this->disableRelativeVolume = $in->getBool(); $this->disableRelativeVolume = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->sound); $out->putByte($this->sound);
$out->putVector3($this->position); $out->putVector3($this->position);
$out->putVarInt($this->extraData); $out->putVarInt($this->extraData);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\network\mcpe\protocol\types\login\JwtChain;
use pocketmine\utils\BinaryStream; use pocketmine\utils\BinaryStream;
use function is_object; use function is_object;
@ -49,7 +49,7 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
return true; return true;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->protocol = $in->getInt(); $this->protocol = $in->getInt();
$this->decodeConnectionRequest($in->getString()); $this->decodeConnectionRequest($in->getString());
} }
@ -74,7 +74,7 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
$this->clientDataJwt = $connRequestReader->get($connRequestReader->getLInt()); $this->clientDataJwt = $connRequestReader->get($connRequestReader->getLInt());
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putInt($this->protocol); $out->putInt($this->protocol);
$out->putString($this->encodeConnectionRequest()); $out->putString($this->encodeConnectionRequest());
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class MapCreateLockedCopyPacket extends DataPacket implements ServerboundPacket{ class MapCreateLockedCopyPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::MAP_CREATE_LOCKED_COPY_PACKET; public const NETWORK_ID = ProtocolInfo::MAP_CREATE_LOCKED_COPY_PACKET;
@ -35,12 +35,12 @@ class MapCreateLockedCopyPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $newMapId; public $newMapId;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->originalMapId = $in->getEntityUniqueId(); $this->originalMapId = $in->getEntityUniqueId();
$this->newMapId = $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->originalMapId);
$out->putEntityUniqueId($this->newMapId); $out->putEntityUniqueId($this->newMapId);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class MapInfoRequestPacket extends DataPacket implements ServerboundPacket{ class MapInfoRequestPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::MAP_INFO_REQUEST_PACKET; public const NETWORK_ID = ProtocolInfo::MAP_INFO_REQUEST_PACKET;
@ -33,11 +33,11 @@ class MapInfoRequestPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $mapId; public $mapId;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->mapId = $in->getEntityUniqueId(); $this->mapId = $in->getEntityUniqueId();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityUniqueId($this->mapId); $out->putEntityUniqueId($this->mapId);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\network\mcpe\protocol\types\inventory\ItemStack;
class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
@ -56,7 +56,7 @@ class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, S
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->head = $in->getSlot(); $this->head = $in->getSlot();
$this->chest = $in->getSlot(); $this->chest = $in->getSlot();
@ -64,7 +64,7 @@ class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, S
$this->feet = $in->getSlot(); $this->feet = $in->getSlot();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putSlot($this->head); $out->putSlot($this->head);
$out->putSlot($this->chest); $out->putSlot($this->chest);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class MobEffectPacket extends DataPacket implements ClientboundPacket{ class MobEffectPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::MOB_EFFECT_PACKET; public const NETWORK_ID = ProtocolInfo::MOB_EFFECT_PACKET;
@ -66,7 +66,7 @@ class MobEffectPacket extends DataPacket implements ClientboundPacket{
return $pk; return $pk;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->eventId = $in->getByte(); $this->eventId = $in->getByte();
$this->effectId = $in->getVarInt(); $this->effectId = $in->getVarInt();
@ -75,7 +75,7 @@ class MobEffectPacket extends DataPacket implements ClientboundPacket{
$this->duration = $in->getVarInt(); $this->duration = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putByte($this->eventId); $out->putByte($this->eventId);
$out->putVarInt($this->effectId); $out->putVarInt($this->effectId);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\network\mcpe\protocol\types\inventory\ItemStack;
class MobEquipmentPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ class MobEquipmentPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
@ -52,7 +52,7 @@ class MobEquipmentPacket extends DataPacket implements ClientboundPacket, Server
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->item = $in->getSlot(); $this->item = $in->getSlot();
$this->inventorySlot = $in->getByte(); $this->inventorySlot = $in->getByte();
@ -60,7 +60,7 @@ class MobEquipmentPacket extends DataPacket implements ClientboundPacket, Server
$this->windowId = $in->getByte(); $this->windowId = $in->getByte();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putSlot($this->item); $out->putSlot($this->item);
$out->putByte($this->inventorySlot); $out->putByte($this->inventorySlot);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ModalFormRequestPacket extends DataPacket implements ClientboundPacket{ class ModalFormRequestPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::MODAL_FORM_REQUEST_PACKET; public const NETWORK_ID = ProtocolInfo::MODAL_FORM_REQUEST_PACKET;
@ -42,12 +42,12 @@ class ModalFormRequestPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->formId = $in->getUnsignedVarInt(); $this->formId = $in->getUnsignedVarInt();
$this->formData = $in->getString(); $this->formData = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->formId); $out->putUnsignedVarInt($this->formId);
$out->putString($this->formData); $out->putString($this->formData);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ModalFormResponsePacket extends DataPacket implements ServerboundPacket{ class ModalFormResponsePacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::MODAL_FORM_RESPONSE_PACKET; public const NETWORK_ID = ProtocolInfo::MODAL_FORM_RESPONSE_PACKET;
@ -35,12 +35,12 @@ class ModalFormResponsePacket extends DataPacket implements ServerboundPacket{
/** @var string */ /** @var string */
public $formData; //json public $formData; //json
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->formId = $in->getUnsignedVarInt(); $this->formId = $in->getUnsignedVarInt();
$this->formData = $in->getString(); $this->formData = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->formId); $out->putUnsignedVarInt($this->formId);
$out->putString($this->formData); $out->putString($this->formData);
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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{ class MoveActorAbsolutePacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::MOVE_ACTOR_ABSOLUTE_PACKET; public const NETWORK_ID = ProtocolInfo::MOVE_ACTOR_ABSOLUTE_PACKET;
@ -48,7 +48,7 @@ class MoveActorAbsolutePacket extends DataPacket implements ClientboundPacket, S
/** @var float */ /** @var float */
public $zRot; public $zRot;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->flags = $in->getByte(); $this->flags = $in->getByte();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
@ -57,7 +57,7 @@ class MoveActorAbsolutePacket extends DataPacket implements ClientboundPacket, S
$this->zRot = $in->getByteRotation(); $this->zRot = $in->getByteRotation();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putByte($this->flags); $out->putByte($this->flags);
$out->putVector3($this->position); $out->putVector3($this->position);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use pocketmine\utils\BinaryDataException; use pocketmine\utils\BinaryDataException;
class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
@ -61,7 +61,7 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
/** /**
* @throws BinaryDataException * @throws BinaryDataException
*/ */
private function maybeReadCoord(int $flag, NetworkBinaryStream $in) : int{ private function maybeReadCoord(int $flag, PacketSerializer $in) : int{
if(($this->flags & $flag) !== 0){ if(($this->flags & $flag) !== 0){
return $in->getVarInt(); return $in->getVarInt();
} }
@ -71,14 +71,14 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
/** /**
* @throws BinaryDataException * @throws BinaryDataException
*/ */
private function maybeReadRotation(int $flag, NetworkBinaryStream $in) : float{ private function maybeReadRotation(int $flag, PacketSerializer $in) : float{
if(($this->flags & $flag) !== 0){ if(($this->flags & $flag) !== 0){
return $in->getByteRotation(); return $in->getByteRotation();
} }
return 0.0; return 0.0;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->flags = $in->getLShort(); $this->flags = $in->getLShort();
$this->xDiff = $this->maybeReadCoord(self::FLAG_HAS_X, $in); $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); $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){ if(($this->flags & $flag) !== 0){
$out->putVarInt($val); $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){ if(($this->flags & $flag) !== 0){
$out->putByteRotation($val); $out->putByteRotation($val);
} }
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putLShort($this->flags); $out->putLShort($this->flags);
$this->maybeWriteCoord(self::FLAG_HAS_X, $this->xDiff, $out); $this->maybeWriteCoord(self::FLAG_HAS_X, $this->xDiff, $out);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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{ class MovePlayerPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::MOVE_PLAYER_PACKET; public const NETWORK_ID = ProtocolInfo::MOVE_PLAYER_PACKET;
@ -57,7 +57,7 @@ class MovePlayerPacket extends DataPacket implements ClientboundPacket, Serverbo
/** @var int */ /** @var int */
public $teleportItem = 0; public $teleportItem = 0;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->position = $in->getVector3(); $this->position = $in->getVector3();
$this->pitch = $in->getLFloat(); $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->putEntityRuntimeId($this->entityRuntimeId);
$out->putVector3($this->position); $out->putVector3($this->position);
$out->putLFloat($this->pitch); $out->putLFloat($this->pitch);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class MultiplayerSettingsPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::MULTIPLAYER_SETTINGS_PACKET; public const NETWORK_ID = ProtocolInfo::MULTIPLAYER_SETTINGS_PACKET;
@ -47,11 +47,11 @@ class MultiplayerSettingsPacket extends DataPacket implements ClientboundPacket,
return $this->action; return $this->action;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->action = $in->getVarInt(); $this->action = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->action); $out->putVarInt($this->action);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class NetworkChunkPublisherUpdatePacket extends DataPacket implements ClientboundPacket{ class NetworkChunkPublisherUpdatePacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::NETWORK_CHUNK_PUBLISHER_UPDATE_PACKET; public const NETWORK_ID = ProtocolInfo::NETWORK_CHUNK_PUBLISHER_UPDATE_PACKET;
@ -48,12 +48,12 @@ class NetworkChunkPublisherUpdatePacket extends DataPacket implements Clientboun
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$in->getSignedBlockPosition($this->x, $this->y, $this->z); $in->getSignedBlockPosition($this->x, $this->y, $this->z);
$this->radius = $in->getUnsignedVarInt(); $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->putSignedBlockPosition($this->x, $this->y, $this->z);
$out->putUnsignedVarInt($this->radius); $out->putUnsignedVarInt($this->radius);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class NetworkSettingsPacket extends DataPacket implements ClientboundPacket{ class NetworkSettingsPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::NETWORK_SETTINGS_PACKET; public const NETWORK_ID = ProtocolInfo::NETWORK_SETTINGS_PACKET;
@ -46,11 +46,11 @@ class NetworkSettingsPacket extends DataPacket implements ClientboundPacket{
return $this->compressionThreshold; return $this->compressionThreshold;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->compressionThreshold = $in->getLShort(); $this->compressionThreshold = $in->getLShort();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putLShort($this->compressionThreshold); $out->putLShort($this->compressionThreshold);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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{ class NetworkStackLatencyPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::NETWORK_STACK_LATENCY_PACKET; public const NETWORK_ID = ProtocolInfo::NETWORK_STACK_LATENCY_PACKET;
@ -35,12 +35,12 @@ class NetworkStackLatencyPacket extends DataPacket implements ClientboundPacket,
/** @var bool */ /** @var bool */
public $needResponse; public $needResponse;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->timestamp = $in->getLLong(); $this->timestamp = $in->getLLong();
$this->needResponse = $in->getBool(); $this->needResponse = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putLLong($this->timestamp); $out->putLLong($this->timestamp);
$out->putBool($this->needResponse); $out->putBool($this->needResponse);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class NpcRequestPacket extends DataPacket implements ServerboundPacket{ class NpcRequestPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::NPC_REQUEST_PACKET; public const NETWORK_ID = ProtocolInfo::NPC_REQUEST_PACKET;
@ -46,14 +46,14 @@ class NpcRequestPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $actionType; public $actionType;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->requestType = $in->getByte(); $this->requestType = $in->getByte();
$this->commandString = $in->getString(); $this->commandString = $in->getString();
$this->actionType = $in->getByte(); $this->actionType = $in->getByte();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putByte($this->requestType); $out->putByte($this->requestType);
$out->putString($this->commandString); $out->putString($this->commandString);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class OnScreenTextureAnimationPacket extends DataPacket implements ClientboundPacket{ class OnScreenTextureAnimationPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::ON_SCREEN_TEXTURE_ANIMATION_PACKET; public const NETWORK_ID = ProtocolInfo::ON_SCREEN_TEXTURE_ANIMATION_PACKET;
@ -33,11 +33,11 @@ class OnScreenTextureAnimationPacket extends DataPacket implements ClientboundPa
/** @var int */ /** @var int */
public $effectId; public $effectId;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->effectId = $in->getLInt(); //unsigned $this->effectId = $in->getLInt(); //unsigned
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putLInt($this->effectId); $out->putLInt($this->effectId);
} }

View File

@ -23,11 +23,11 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol; namespace pocketmine\network\mcpe\protocol;
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
interface Packet{ interface Packet{
public function getBinaryStream() : NetworkBinaryStream; public function getBinaryStream() : PacketSerializer;
public function pid() : int; public function pid() : int;

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class PhotoTransferPacket extends DataPacket implements ClientboundPacket{ class PhotoTransferPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::PHOTO_TRANSFER_PACKET; public const NETWORK_ID = ProtocolInfo::PHOTO_TRANSFER_PACKET;
@ -37,13 +37,13 @@ class PhotoTransferPacket extends DataPacket implements ClientboundPacket{
/** @var string */ /** @var string */
public $bookId; //photos are stored in a sibling directory to the games folder (screenshots/(some UUID)/bookID/example.png) 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->photoName = $in->getString();
$this->photoData = $in->getString(); $this->photoData = $in->getString();
$this->bookId = $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->photoName);
$out->putString($this->photoData); $out->putString($this->photoData);
$out->putString($this->bookId); $out->putString($this->bookId);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class PlaySoundPacket extends DataPacket implements ClientboundPacket{ class PlaySoundPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET; public const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET;
@ -43,7 +43,7 @@ class PlaySoundPacket extends DataPacket implements ClientboundPacket{
/** @var float */ /** @var float */
public $pitch; public $pitch;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->soundName = $in->getString(); $this->soundName = $in->getString();
$in->getBlockPosition($this->x, $this->y, $this->z); $in->getBlockPosition($this->x, $this->y, $this->z);
$this->x /= 8; $this->x /= 8;
@ -53,7 +53,7 @@ class PlaySoundPacket extends DataPacket implements ClientboundPacket{
$this->pitch = $in->getLFloat(); $this->pitch = $in->getLFloat();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->soundName); $out->putString($this->soundName);
$out->putBlockPosition((int) ($this->x * 8), (int) ($this->y * 8), (int) ($this->z * 8)); $out->putBlockPosition((int) ($this->x * 8), (int) ($this->y * 8), (int) ($this->z * 8));
$out->putLFloat($this->volume); $out->putLFloat($this->volume);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class PlayStatusPacket extends DataPacket implements ClientboundPacket{ class PlayStatusPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::PLAY_STATUS_PACKET; public const NETWORK_ID = ProtocolInfo::PLAY_STATUS_PACKET;
@ -48,7 +48,7 @@ class PlayStatusPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->status = $in->getInt(); $this->status = $in->getInt();
} }
@ -56,7 +56,7 @@ class PlayStatusPacket extends DataPacket implements ClientboundPacket{
return true; return true;
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putInt($this->status); $out->putInt($this->status);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class PlayerActionPacket extends DataPacket implements ServerboundPacket{ class PlayerActionPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::PLAYER_ACTION_PACKET; public const NETWORK_ID = ProtocolInfo::PLAYER_ACTION_PACKET;
@ -70,14 +70,14 @@ class PlayerActionPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $face; public $face;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
$this->action = $in->getVarInt(); $this->action = $in->getVarInt();
$in->getBlockPosition($this->x, $this->y, $this->z); $in->getBlockPosition($this->x, $this->y, $this->z);
$this->face = $in->getVarInt(); $this->face = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);
$out->putVarInt($this->action); $out->putVarInt($this->action);
$out->putBlockPosition($this->x, $this->y, $this->z); $out->putBlockPosition($this->x, $this->y, $this->z);

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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\InputMode;
use pocketmine\network\mcpe\protocol\types\PlayMode; use pocketmine\network\mcpe\protocol\types\PlayMode;
use function assert; use function assert;
@ -127,7 +127,7 @@ class PlayerAuthInputPacket extends DataPacket implements ServerboundPacket{
return $this->vrGazeDirection; return $this->vrGazeDirection;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->yaw = $in->getLFloat(); $this->yaw = $in->getLFloat();
$this->pitch = $in->getLFloat(); $this->pitch = $in->getLFloat();
$this->position = $in->getVector3(); $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->yaw);
$out->putLFloat($this->pitch); $out->putLFloat($this->pitch);
$out->putVector3($this->position); $out->putVector3($this->position);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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; use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds;
class PlayerHotbarPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ class PlayerHotbarPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
@ -46,13 +46,13 @@ class PlayerHotbarPacket extends DataPacket implements ClientboundPacket, Server
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->selectedHotbarSlot = $in->getUnsignedVarInt(); $this->selectedHotbarSlot = $in->getUnsignedVarInt();
$this->windowId = $in->getByte(); $this->windowId = $in->getByte();
$this->selectHotbarSlot = $in->getBool(); $this->selectHotbarSlot = $in->getBool();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->selectedHotbarSlot); $out->putUnsignedVarInt($this->selectedHotbarSlot);
$out->putByte($this->windowId); $out->putByte($this->windowId);
$out->putBool($this->selectHotbarSlot); $out->putBool($this->selectHotbarSlot);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class PlayerInputPacket extends DataPacket implements ServerboundPacket{ class PlayerInputPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::PLAYER_INPUT_PACKET; public const NETWORK_ID = ProtocolInfo::PLAYER_INPUT_PACKET;
@ -39,14 +39,14 @@ class PlayerInputPacket extends DataPacket implements ServerboundPacket{
/** @var bool */ /** @var bool */
public $sneaking; public $sneaking;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->motionX = $in->getLFloat(); $this->motionX = $in->getLFloat();
$this->motionY = $in->getLFloat(); $this->motionY = $in->getLFloat();
$this->jumping = $in->getBool(); $this->jumping = $in->getBool();
$this->sneaking = $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->motionX);
$out->putLFloat($this->motionY); $out->putLFloat($this->motionY);
$out->putBool($this->jumping); $out->putBool($this->jumping);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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 pocketmine\network\mcpe\protocol\types\PlayerListEntry;
use function count; use function count;
@ -60,7 +60,7 @@ class PlayerListPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->type = $in->getByte(); $this->type = $in->getByte();
$count = $in->getUnsignedVarInt(); $count = $in->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){ 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->putByte($this->type);
$out->putUnsignedVarInt(count($this->entries)); $out->putUnsignedVarInt(count($this->entries));
foreach($this->entries as $entry){ foreach($this->entries as $entry){

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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\network\mcpe\protocol\types\SkinData;
use pocketmine\uuid\UUID; use pocketmine\uuid\UUID;
@ -41,7 +41,7 @@ class PlayerSkinPacket extends DataPacket implements ClientboundPacket, Serverbo
/** @var SkinData */ /** @var SkinData */
public $skin; public $skin;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->uuid = $in->getUUID(); $this->uuid = $in->getUUID();
$this->skin = $in->getSkin(); $this->skin = $in->getSkin();
$this->newSkinName = $in->getString(); $this->newSkinName = $in->getString();
@ -49,7 +49,7 @@ class PlayerSkinPacket extends DataPacket implements ClientboundPacket, Serverbo
$this->skin->setVerified($in->getBool()); $this->skin->setVerified($in->getBool());
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUUID($this->uuid); $out->putUUID($this->uuid);
$out->putSkin($this->skin); $out->putSkin($this->skin);
$out->putString($this->newSkinName); $out->putString($this->newSkinName);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use function count; use function count;
class PurchaseReceiptPacket extends DataPacket implements ServerboundPacket{ class PurchaseReceiptPacket extends DataPacket implements ServerboundPacket{
@ -34,14 +34,14 @@ class PurchaseReceiptPacket extends DataPacket implements ServerboundPacket{
/** @var string[] */ /** @var string[] */
public $entries = []; public $entries = [];
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$count = $in->getUnsignedVarInt(); $count = $in->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){ for($i = 0; $i < $count; ++$i){
$this->entries[] = $in->getString(); $this->entries[] = $in->getString();
} }
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt(count($this->entries)); $out->putUnsignedVarInt(count($this->entries));
foreach($this->entries as $entry){ foreach($this->entries as $entry){
$out->putString($entry); $out->putString($entry);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class RemoveActorPacket extends DataPacket implements ClientboundPacket{ class RemoveActorPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::REMOVE_ACTOR_PACKET; public const NETWORK_ID = ProtocolInfo::REMOVE_ACTOR_PACKET;
@ -39,11 +39,11 @@ class RemoveActorPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->entityUniqueId = $in->getEntityUniqueId(); $this->entityUniqueId = $in->getEntityUniqueId();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityUniqueId($this->entityUniqueId); $out->putEntityUniqueId($this->entityUniqueId);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class RemoveEntityPacket extends DataPacket implements ClientboundPacket{ class RemoveEntityPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::REMOVE_ENTITY_PACKET; public const NETWORK_ID = ProtocolInfo::REMOVE_ENTITY_PACKET;
@ -43,11 +43,11 @@ class RemoveEntityPacket extends DataPacket implements ClientboundPacket{
return $this->uvarint1; return $this->uvarint1;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->uvarint1 = $in->getUnsignedVarInt(); $this->uvarint1 = $in->getUnsignedVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putUnsignedVarInt($this->uvarint1); $out->putUnsignedVarInt($this->uvarint1);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class RemoveObjectivePacket extends DataPacket implements ClientboundPacket{ class RemoveObjectivePacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::REMOVE_OBJECTIVE_PACKET; public const NETWORK_ID = ProtocolInfo::REMOVE_OBJECTIVE_PACKET;
@ -33,11 +33,11 @@ class RemoveObjectivePacket extends DataPacket implements ClientboundPacket{
/** @var string */ /** @var string */
public $objectiveName; public $objectiveName;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->objectiveName = $in->getString(); $this->objectiveName = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->objectiveName); $out->putString($this->objectiveName);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class RequestChunkRadiusPacket extends DataPacket implements ServerboundPacket{ class RequestChunkRadiusPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET; public const NETWORK_ID = ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET;
@ -33,11 +33,11 @@ class RequestChunkRadiusPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $radius; public $radius;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->radius = $in->getVarInt(); $this->radius = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->radius); $out->putVarInt($this->radius);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ResourcePackChunkDataPacket extends DataPacket implements ClientboundPacket{ class ResourcePackChunkDataPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET; public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET;
@ -48,14 +48,14 @@ class ResourcePackChunkDataPacket extends DataPacket implements ClientboundPacke
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->packId = $in->getString(); $this->packId = $in->getString();
$this->chunkIndex = $in->getLInt(); $this->chunkIndex = $in->getLInt();
$this->progress = $in->getLLong(); $this->progress = $in->getLLong();
$this->data = $in->getString(); $this->data = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->packId); $out->putString($this->packId);
$out->putLInt($this->chunkIndex); $out->putLInt($this->chunkIndex);
$out->putLLong($this->progress); $out->putLLong($this->progress);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class ResourcePackChunkRequestPacket extends DataPacket implements ServerboundPacket{ class ResourcePackChunkRequestPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_REQUEST_PACKET; public const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_REQUEST_PACKET;
@ -35,12 +35,12 @@ class ResourcePackChunkRequestPacket extends DataPacket implements ServerboundPa
/** @var int */ /** @var int */
public $chunkIndex; public $chunkIndex;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->packId = $in->getString(); $this->packId = $in->getString();
$this->chunkIndex = $in->getLInt(); $this->chunkIndex = $in->getLInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->packId); $out->putString($this->packId);
$out->putLInt($this->chunkIndex); $out->putLInt($this->chunkIndex);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
use function count; use function count;
class ResourcePackClientResponsePacket extends DataPacket implements ServerboundPacket{ class ResourcePackClientResponsePacket extends DataPacket implements ServerboundPacket{
@ -41,7 +41,7 @@ class ResourcePackClientResponsePacket extends DataPacket implements Serverbound
/** @var string[] */ /** @var string[] */
public $packIds = []; public $packIds = [];
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->status = $in->getByte(); $this->status = $in->getByte();
$entryCount = $in->getLShort(); $entryCount = $in->getLShort();
while($entryCount-- > 0){ 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->putByte($this->status);
$out->putLShort(count($this->packIds)); $out->putLShort(count($this->packIds));
foreach($this->packIds as $id){ foreach($this->packIds as $id){

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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; use pocketmine\network\mcpe\protocol\types\resourcepacks\ResourcePackType;
class ResourcePackDataInfoPacket extends DataPacket implements ClientboundPacket{ class ResourcePackDataInfoPacket extends DataPacket implements ClientboundPacket{
@ -56,7 +56,7 @@ class ResourcePackDataInfoPacket extends DataPacket implements ClientboundPacket
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->packId = $in->getString(); $this->packId = $in->getString();
$this->maxChunkSize = $in->getLInt(); $this->maxChunkSize = $in->getLInt();
$this->chunkCount = $in->getLInt(); $this->chunkCount = $in->getLInt();
@ -66,7 +66,7 @@ class ResourcePackDataInfoPacket extends DataPacket implements ClientboundPacket
$this->packType = $in->getByte(); $this->packType = $in->getByte();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putString($this->packId); $out->putString($this->packId);
$out->putLInt($this->maxChunkSize); $out->putLInt($this->maxChunkSize);
$out->putLInt($this->chunkCount); $out->putLInt($this->chunkCount);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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 pocketmine\network\mcpe\protocol\types\resourcepacks\ResourcePackStackEntry;
use function count; use function count;
@ -60,7 +60,7 @@ class ResourcePackStackPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->mustAccept = $in->getBool(); $this->mustAccept = $in->getBool();
$behaviorPackCount = $in->getUnsignedVarInt(); $behaviorPackCount = $in->getUnsignedVarInt();
while($behaviorPackCount-- > 0){ while($behaviorPackCount-- > 0){
@ -76,7 +76,7 @@ class ResourcePackStackPacket extends DataPacket implements ClientboundPacket{
$this->baseGameVersion = $in->getString(); $this->baseGameVersion = $in->getString();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putBool($this->mustAccept); $out->putBool($this->mustAccept);
$out->putUnsignedVarInt(count($this->behaviorPackStack)); $out->putUnsignedVarInt(count($this->behaviorPackStack));

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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 pocketmine\network\mcpe\protocol\types\resourcepacks\ResourcePackInfoEntry;
use function count; use function count;
@ -56,7 +56,7 @@ class ResourcePacksInfoPacket extends DataPacket implements ClientboundPacket{
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->mustAccept = $in->getBool(); $this->mustAccept = $in->getBool();
$this->hasScripts = $in->getBool(); $this->hasScripts = $in->getBool();
$behaviorPackCount = $in->getLShort(); $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->mustAccept);
$out->putBool($this->hasScripts); $out->putBool($this->hasScripts);
$out->putLShort(count($this->behaviorPackEntries)); $out->putLShort(count($this->behaviorPackEntries));

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\math\Vector3; 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{ class RespawnPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::RESPAWN_PACKET; public const NETWORK_ID = ProtocolInfo::RESPAWN_PACKET;
@ -50,13 +50,13 @@ class RespawnPacket extends DataPacket implements ClientboundPacket, Serverbound
return $result; return $result;
} }
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->position = $in->getVector3(); $this->position = $in->getVector3();
$this->respawnState = $in->getByte(); $this->respawnState = $in->getByte();
$this->entityRuntimeId = $in->getEntityRuntimeId(); $this->entityRuntimeId = $in->getEntityRuntimeId();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVector3($this->position); $out->putVector3($this->position);
$out->putByte($this->respawnState); $out->putByte($this->respawnState);
$out->putEntityRuntimeId($this->entityRuntimeId); $out->putEntityRuntimeId($this->entityRuntimeId);

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\NetworkBinaryStream; use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class RiderJumpPacket extends DataPacket implements ServerboundPacket{ class RiderJumpPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::RIDER_JUMP_PACKET; public const NETWORK_ID = ProtocolInfo::RIDER_JUMP_PACKET;
@ -33,11 +33,11 @@ class RiderJumpPacket extends DataPacket implements ServerboundPacket{
/** @var int */ /** @var int */
public $jumpStrength; //percentage public $jumpStrength; //percentage
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->jumpStrength = $in->getVarInt(); $this->jumpStrength = $in->getVarInt();
} }
protected function encodePayload(NetworkBinaryStream $out) : void{ protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->jumpStrength); $out->putVarInt($this->jumpStrength);
} }

View File

@ -25,7 +25,7 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h> #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 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; 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 */ /** @var string json data */
public $eventData; public $eventData;
protected function decodePayload(NetworkBinaryStream $in) : void{ protected function decodePayload(PacketSerializer $in) : void{
$this->eventName = $in->getString(); $this->eventName = $in->getString();
$this->eventData = $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->eventName);
$out->putString($this->eventData); $out->putString($this->eventData);
} }

Some files were not shown because too many files have changed in this diff Show More