mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 01:39:52 +00:00
Cleaned up some bad code in DataPacket, added encode/decodeHeader and made encode/decodePayload protected
This commit is contained in:
parent
8a151dc373
commit
7886918140
@ -33,11 +33,11 @@ class AddBehaviorTreePacket extends DataPacket{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $unknownString1;
|
public $unknownString1;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->unknownString1 = $this->getString();
|
$this->unknownString1 = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->unknownString1);
|
$this->putString($this->unknownString1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class AddEntityPacket extends DataPacket{
|
|||||||
public $metadata = [];
|
public $metadata = [];
|
||||||
public $links = [];
|
public $links = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->type = $this->getUnsignedVarInt();
|
$this->type = $this->getUnsignedVarInt();
|
||||||
@ -83,7 +83,7 @@ class AddEntityPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putUnsignedVarInt($this->type);
|
$this->putUnsignedVarInt($this->type);
|
||||||
|
@ -37,14 +37,14 @@ class AddHangingEntityPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $unknown; //TODO (rotation?)
|
public $unknown; //TODO (rotation?)
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->unknown = $this->getVarInt();
|
$this->unknown = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId);
|
$this->putEntityUniqueId($this->entityUniqueId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
|
@ -44,7 +44,7 @@ class AddItemEntityPacket extends DataPacket{
|
|||||||
public $speedZ = 0.0;
|
public $speedZ = 0.0;
|
||||||
public $metadata = [];
|
public $metadata = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->item = $this->getSlot();
|
$this->item = $this->getSlot();
|
||||||
@ -53,7 +53,7 @@ class AddItemEntityPacket extends DataPacket{
|
|||||||
$this->metadata = $this->getEntityMetadata();
|
$this->metadata = $this->getEntityMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putSlot($this->item);
|
$this->putSlot($this->item);
|
||||||
|
@ -41,7 +41,7 @@ class AddPaintingPacket extends DataPacket{
|
|||||||
public $direction;
|
public $direction;
|
||||||
public $title;
|
public $title;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
@ -49,7 +49,7 @@ class AddPaintingPacket extends DataPacket{
|
|||||||
$this->title = $this->getString();
|
$this->title = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
|
@ -60,7 +60,7 @@ class AddPlayerPacket extends DataPacket{
|
|||||||
public $uvarint4 = 0;
|
public $uvarint4 = 0;
|
||||||
public $long1 = 0;
|
public $long1 = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->uuid = $this->getUUID();
|
$this->uuid = $this->getUUID();
|
||||||
$this->username = $this->getString();
|
$this->username = $this->getString();
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
@ -80,7 +80,7 @@ class AddPlayerPacket extends DataPacket{
|
|||||||
$this->long1 = $this->getLLong();
|
$this->long1 = $this->getLLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUUID($this->uuid);
|
$this->putUUID($this->uuid);
|
||||||
$this->putString($this->username);
|
$this->putString($this->username);
|
||||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||||
|
@ -71,7 +71,7 @@ class AdventureSettingsPacket extends DataPacket{
|
|||||||
public $playerPermission = PlayerPermissions::MEMBER;
|
public $playerPermission = PlayerPermissions::MEMBER;
|
||||||
public $long1 = 0;
|
public $long1 = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->flags = $this->getUnsignedVarInt();
|
$this->flags = $this->getUnsignedVarInt();
|
||||||
$this->commandPermission = $this->getUnsignedVarInt();
|
$this->commandPermission = $this->getUnsignedVarInt();
|
||||||
$this->flags2 = $this->getUnsignedVarInt();
|
$this->flags2 = $this->getUnsignedVarInt();
|
||||||
@ -79,7 +79,7 @@ class AdventureSettingsPacket extends DataPacket{
|
|||||||
$this->long1 = $this->getLLong();
|
$this->long1 = $this->getLLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt($this->flags);
|
$this->putUnsignedVarInt($this->flags);
|
||||||
$this->putUnsignedVarInt($this->commandPermission);
|
$this->putUnsignedVarInt($this->commandPermission);
|
||||||
$this->putUnsignedVarInt($this->flags2);
|
$this->putUnsignedVarInt($this->flags2);
|
||||||
|
@ -40,7 +40,7 @@ class AnimatePacket extends DataPacket{
|
|||||||
public $entityRuntimeId;
|
public $entityRuntimeId;
|
||||||
public $float = 0.0; //TODO (Boat rowing time?)
|
public $float = 0.0; //TODO (Boat rowing time?)
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->action = $this->getVarInt();
|
$this->action = $this->getVarInt();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
if($this->action & 0x80){
|
if($this->action & 0x80){
|
||||||
@ -48,7 +48,7 @@ class AnimatePacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->action);
|
$this->putVarInt($this->action);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
if($this->action & 0x80){
|
if($this->action & 0x80){
|
||||||
|
@ -33,12 +33,12 @@ class AvailableCommandsPacket extends DataPacket{
|
|||||||
public $commands; //JSON-encoded command data
|
public $commands; //JSON-encoded command data
|
||||||
public $unknown = "";
|
public $unknown = "";
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->commands = $this->getString();
|
$this->commands = $this->getString();
|
||||||
$this->unknown = $this->getString();
|
$this->unknown = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->commands);
|
$this->putString($this->commands);
|
||||||
$this->putString($this->unknown);
|
$this->putString($this->unknown);
|
||||||
}
|
}
|
||||||
|
@ -48,23 +48,12 @@ class BatchPacket extends DataPacket{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decode(){
|
protected function decodeHeader(){
|
||||||
$this->offset = 1;
|
$pid = $this->getByte();
|
||||||
$this->decodePayload();
|
assert($pid === static::NETWORK_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
protected function decodePayload(){
|
||||||
$this->reset();
|
|
||||||
$this->encodePayload();
|
|
||||||
$this->isEncoded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reset(){
|
|
||||||
$this->buffer = "\xfe";
|
|
||||||
$this->offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function decodePayload(){
|
|
||||||
$data = $this->getRemaining();
|
$data = $this->getRemaining();
|
||||||
try{
|
try{
|
||||||
$this->payload = zlib_decode($data, 1024 * 1024 * 64); //Max 64MB
|
$this->payload = zlib_decode($data, 1024 * 1024 * 64); //Max 64MB
|
||||||
@ -73,7 +62,11 @@ class BatchPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodeHeader(){
|
||||||
|
$this->putByte(static::NETWORK_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function encodePayload(){
|
||||||
$this->put(zlib_encode($this->payload, ZLIB_ENCODING_DEFLATE, $this->compressionLevel));
|
$this->put(zlib_encode($this->payload, ZLIB_ENCODING_DEFLATE, $this->compressionLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ class BlockEntityDataPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $namedtag;
|
public $namedtag;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->namedtag = $this->getRemaining();
|
$this->namedtag = $this->getRemaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->put($this->namedtag);
|
$this->put($this->namedtag);
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,13 @@ class BlockEventPacket extends DataPacket{
|
|||||||
public $case1;
|
public $case1;
|
||||||
public $case2;
|
public $case2;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->case1 = $this->getVarInt();
|
$this->case1 = $this->getVarInt();
|
||||||
$this->case2 = $this->getVarInt();
|
$this->case2 = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->putVarInt($this->case1);
|
$this->putVarInt($this->case1);
|
||||||
$this->putVarInt($this->case2);
|
$this->putVarInt($this->case2);
|
||||||
|
@ -38,13 +38,13 @@ class BlockPickRequestPacket extends DataPacket{
|
|||||||
public $addUserData = false;
|
public $addUserData = false;
|
||||||
public $hotbarSlot;
|
public $hotbarSlot;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ);
|
$this->getSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ);
|
||||||
$this->addUserData = $this->getBool();
|
$this->addUserData = $this->getBool();
|
||||||
$this->hotbarSlot = $this->getByte();
|
$this->hotbarSlot = $this->getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ);
|
$this->putSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ);
|
||||||
$this->putBool($this->addUserData);
|
$this->putBool($this->addUserData);
|
||||||
$this->putByte($this->hotbarSlot);
|
$this->putByte($this->hotbarSlot);
|
||||||
|
@ -55,7 +55,7 @@ class BookEditPacket extends DataPacket{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $author;
|
public $author;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->type = $this->getByte();
|
$this->type = $this->getByte();
|
||||||
$this->inventorySlot = $this->getByte();
|
$this->inventorySlot = $this->getByte();
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class BookEditPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->type);
|
$this->putByte($this->type);
|
||||||
$this->putByte($this->inventorySlot);
|
$this->putByte($this->inventorySlot);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class BossEventPacket extends DataPacket{
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public $overlay;
|
public $overlay;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->bossEid = $this->getEntityUniqueId();
|
$this->bossEid = $this->getEntityUniqueId();
|
||||||
$this->eventType = $this->getUnsignedVarInt();
|
$this->eventType = $this->getUnsignedVarInt();
|
||||||
switch($this->eventType){
|
switch($this->eventType){
|
||||||
@ -94,7 +94,7 @@ class BossEventPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->bossEid);
|
$this->putEntityUniqueId($this->bossEid);
|
||||||
$this->putUnsignedVarInt($this->eventType);
|
$this->putUnsignedVarInt($this->eventType);
|
||||||
switch($this->eventType){
|
switch($this->eventType){
|
||||||
|
@ -35,12 +35,12 @@ class CameraPacket extends DataPacket{
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public $playerUniqueId;
|
public $playerUniqueId;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->cameraUniqueId = $this->getEntityUniqueId();
|
$this->cameraUniqueId = $this->getEntityUniqueId();
|
||||||
$this->playerUniqueId = $this->getEntityUniqueId();
|
$this->playerUniqueId = $this->getEntityUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->cameraUniqueId);
|
$this->putEntityUniqueId($this->cameraUniqueId);
|
||||||
$this->putEntityUniqueId($this->playerUniqueId);
|
$this->putEntityUniqueId($this->playerUniqueId);
|
||||||
}
|
}
|
||||||
|
@ -42,13 +42,13 @@ class ChangeDimensionPacket extends DataPacket{
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $respawn = false;
|
public $respawn = false;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->dimension = $this->getVarInt();
|
$this->dimension = $this->getVarInt();
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->respawn = $this->getBool();
|
$this->respawn = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->dimension);
|
$this->putVarInt($this->dimension);
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putBool($this->respawn);
|
$this->putBool($this->respawn);
|
||||||
|
@ -33,11 +33,11 @@ class ChunkRadiusUpdatedPacket extends DataPacket{
|
|||||||
|
|
||||||
public $radius;
|
public $radius;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->radius = $this->getVarInt();
|
$this->radius = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->radius);
|
$this->putVarInt($this->radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ class ClientToServerHandshakePacket extends DataPacket{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
//No payload
|
//No payload
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//No payload
|
//No payload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
|||||||
/** @var Color[][] */
|
/** @var Color[][] */
|
||||||
public $colors = [];
|
public $colors = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->mapId = $this->getEntityUniqueId();
|
$this->mapId = $this->getEntityUniqueId();
|
||||||
$this->type = $this->getUnsignedVarInt();
|
$this->type = $this->getUnsignedVarInt();
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->mapId);
|
$this->putEntityUniqueId($this->mapId);
|
||||||
|
|
||||||
$type = 0;
|
$type = 0;
|
||||||
|
@ -49,7 +49,7 @@ class CommandBlockUpdatePacket extends DataPacket{
|
|||||||
|
|
||||||
public $shouldTrackOutput;
|
public $shouldTrackOutput;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->isBlock = $this->getBool();
|
$this->isBlock = $this->getBool();
|
||||||
|
|
||||||
if($this->isBlock){
|
if($this->isBlock){
|
||||||
@ -69,7 +69,7 @@ class CommandBlockUpdatePacket extends DataPacket{
|
|||||||
$this->shouldTrackOutput = $this->getBool();
|
$this->shouldTrackOutput = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBool($this->isBlock);
|
$this->putBool($this->isBlock);
|
||||||
|
|
||||||
if($this->isBlock){
|
if($this->isBlock){
|
||||||
|
@ -30,11 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
|||||||
class CommandOutputPacket extends DataPacket{
|
class CommandOutputPacket extends DataPacket{
|
||||||
const NETWORK_ID = ProtocolInfo::COMMAND_OUTPUT_PACKET;
|
const NETWORK_ID = ProtocolInfo::COMMAND_OUTPUT_PACKET;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,12 +32,12 @@ class CommandRequestPacket extends DataPacket{
|
|||||||
|
|
||||||
public $command;
|
public $command;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->command = $this->getString();
|
$this->command = $this->getString();
|
||||||
//TODO: everything else
|
//TODO: everything else
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->command);
|
$this->putString($this->command);
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ class ContainerClosePacket extends DataPacket{
|
|||||||
|
|
||||||
public $windowid;
|
public $windowid;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->windowid = $this->getByte();
|
$this->windowid = $this->getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,14 +38,14 @@ class ContainerOpenPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $entityUniqueId = -1;
|
public $entityUniqueId = -1;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->windowid = $this->getByte();
|
$this->windowid = $this->getByte();
|
||||||
$this->type = $this->getByte();
|
$this->type = $this->getByte();
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putByte($this->type);
|
$this->putByte($this->type);
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
|
@ -35,13 +35,13 @@ class ContainerSetDataPacket extends DataPacket{
|
|||||||
public $property;
|
public $property;
|
||||||
public $value;
|
public $value;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->windowid = $this->getByte();
|
$this->windowid = $this->getByte();
|
||||||
$this->property = $this->getVarInt();
|
$this->property = $this->getVarInt();
|
||||||
$this->value = $this->getVarInt();
|
$this->value = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putVarInt($this->property);
|
$this->putVarInt($this->property);
|
||||||
$this->putVarInt($this->value);
|
$this->putVarInt($this->value);
|
||||||
|
@ -41,7 +41,7 @@ class ContainerSetSlotPacket extends DataPacket{
|
|||||||
public $item;
|
public $item;
|
||||||
public $selectSlot = 0;
|
public $selectSlot = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->windowid = $this->getByte();
|
$this->windowid = $this->getByte();
|
||||||
$this->slot = $this->getVarInt();
|
$this->slot = $this->getVarInt();
|
||||||
$this->hotbarSlot = $this->getVarInt();
|
$this->hotbarSlot = $this->getVarInt();
|
||||||
@ -49,7 +49,7 @@ class ContainerSetSlotPacket extends DataPacket{
|
|||||||
$this->selectSlot = $this->getByte();
|
$this->selectSlot = $this->getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putVarInt($this->slot);
|
$this->putVarInt($this->slot);
|
||||||
$this->putVarInt($this->hotbarSlot);
|
$this->putVarInt($this->hotbarSlot);
|
||||||
|
@ -52,7 +52,7 @@ class CraftingDataPacket extends DataPacket{
|
|||||||
return parent::clean();
|
return parent::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$entries = [];
|
$entries = [];
|
||||||
$recipeCount = $this->getUnsignedVarInt();
|
$recipeCount = $this->getUnsignedVarInt();
|
||||||
for($i = 0; $i < $recipeCount; ++$i){
|
for($i = 0; $i < $recipeCount; ++$i){
|
||||||
@ -182,7 +182,7 @@ class CraftingDataPacket extends DataPacket{
|
|||||||
$this->entries[] = $recipe;
|
$this->entries[] = $recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt(count($this->entries));
|
$this->putUnsignedVarInt(count($this->entries));
|
||||||
|
|
||||||
$writer = new BinaryStream();
|
$writer = new BinaryStream();
|
||||||
|
@ -47,7 +47,7 @@ class CraftingEventPacket extends DataPacket{
|
|||||||
return parent::clean();
|
return parent::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->windowId = $this->getByte();
|
$this->windowId = $this->getByte();
|
||||||
$this->type = $this->getVarInt();
|
$this->type = $this->getVarInt();
|
||||||
$this->id = $this->getUUID();
|
$this->id = $this->getUUID();
|
||||||
@ -63,7 +63,7 @@ class CraftingEventPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->windowId);
|
$this->putByte($this->windowId);
|
||||||
$this->putVarInt($this->type);
|
$this->putVarInt($this->type);
|
||||||
$this->putUUID($this->id);
|
$this->putUUID($this->id);
|
||||||
|
@ -41,6 +41,9 @@ abstract class DataPacket extends BinaryStream{
|
|||||||
|
|
||||||
public $isEncoded = false;
|
public $isEncoded = false;
|
||||||
|
|
||||||
|
public $extraByte1 = 0;
|
||||||
|
public $extraByte2 = 0;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
return $this::NETWORK_ID;
|
return $this::NETWORK_ID;
|
||||||
}
|
}
|
||||||
@ -58,28 +61,44 @@ abstract class DataPacket extends BinaryStream{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->offset = 3;
|
$this->offset = 0;
|
||||||
|
$this->decodeHeader();
|
||||||
$this->decodePayload();
|
$this->decodePayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function decodeHeader(){
|
||||||
|
$pid = $this->getUnsignedVarInt();
|
||||||
|
assert($pid === static::NETWORK_ID);
|
||||||
|
|
||||||
|
$this->extraByte1 = $this->getByte();
|
||||||
|
$this->extraByte2 = $this->getByte();
|
||||||
|
assert($this->extraByte1 === 0 and $this->extraByte2 === 0, "Got unexpected non-zero split-screen bytes (byte1: $this->extraByte1, byte2: $this->extraByte2");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note for plugin developers: If you're adding your own packets, you should perform decoding in here.
|
* Note for plugin developers: If you're adding your own packets, you should perform decoding in here.
|
||||||
*/
|
*/
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->put("\x00\x00");
|
|
||||||
$this->encodePayload();
|
$this->encodePayload();
|
||||||
$this->isEncoded = true;
|
$this->isEncoded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function encodeHeader(){
|
||||||
|
$this->putUnsignedVarInt(static::NETWORK_ID);
|
||||||
|
|
||||||
|
$this->putByte($this->extraByte1);
|
||||||
|
$this->putByte($this->extraByte2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note for plugin developers: If you're adding your own packets, you should perform encoding in here.
|
* Note for plugin developers: If you're adding your own packets, you should perform encoding in here.
|
||||||
*/
|
*/
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +115,7 @@ abstract class DataPacket extends BinaryStream{
|
|||||||
abstract public function handle(NetworkSession $session) : bool;
|
abstract public function handle(NetworkSession $session) : bool;
|
||||||
|
|
||||||
public function reset(){
|
public function reset(){
|
||||||
$this->buffer = Binary::writeUnsignedVarInt(static::NETWORK_ID);
|
$this->encodeHeader();
|
||||||
$this->offset = 0;
|
$this->offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ class DisconnectPacket extends DataPacket{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->hideDisconnectionScreen = $this->getBool();
|
$this->hideDisconnectionScreen = $this->getBool();
|
||||||
$this->message = $this->getString();
|
$this->message = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBool($this->hideDisconnectionScreen);
|
$this->putBool($this->hideDisconnectionScreen);
|
||||||
if(!$this->hideDisconnectionScreen){
|
if(!$this->hideDisconnectionScreen){
|
||||||
$this->putString($this->message);
|
$this->putString($this->message);
|
||||||
|
@ -39,12 +39,12 @@ class DropItemPacket extends DataPacket{
|
|||||||
/** @var Item */
|
/** @var Item */
|
||||||
public $item;
|
public $item;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->type = $this->getByte();
|
$this->type = $this->getByte();
|
||||||
$this->item = $this->getSlot();
|
$this->item = $this->getSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->type);
|
$this->putByte($this->type);
|
||||||
$this->putSlot($this->item);
|
$this->putSlot($this->item);
|
||||||
}
|
}
|
||||||
|
@ -54,13 +54,13 @@ class EntityEventPacket extends DataPacket{
|
|||||||
public $event;
|
public $event;
|
||||||
public $data = 0;
|
public $data = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->event = $this->getByte();
|
$this->event = $this->getByte();
|
||||||
$this->data = $this->getVarInt();
|
$this->data = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putByte($this->event);
|
$this->putByte($this->event);
|
||||||
$this->putVarInt($this->data);
|
$this->putVarInt($this->data);
|
||||||
|
@ -35,13 +35,13 @@ class EntityFallPacket extends DataPacket{
|
|||||||
public $fallDistance;
|
public $fallDistance;
|
||||||
public $bool1;
|
public $bool1;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->fallDistance = $this->getLFloat();
|
$this->fallDistance = $this->getLFloat();
|
||||||
$this->bool1 = $this->getBool();
|
$this->bool1 = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putLFloat($this->fallDistance);
|
$this->putLFloat($this->fallDistance);
|
||||||
$this->putBool($this->bool1);
|
$this->putBool($this->bool1);
|
||||||
|
@ -33,12 +33,12 @@ class EntityPickRequestPacket extends DataPacket{
|
|||||||
public $entityTypeId;
|
public $entityTypeId;
|
||||||
public $hotbarSlot;
|
public $hotbarSlot;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityTypeId = $this->getLLong();
|
$this->entityTypeId = $this->getLLong();
|
||||||
$this->hotbarSlot = $this->getByte();
|
$this->hotbarSlot = $this->getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putLLong($this->entityTypeId);
|
$this->putLLong($this->entityTypeId);
|
||||||
$this->putByte($this->hotbarSlot);
|
$this->putByte($this->hotbarSlot);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class EventPacket extends DataPacket{
|
|||||||
public $eventData;
|
public $eventData;
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->playerRuntimeId = $this->getEntityRuntimeId();
|
$this->playerRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->eventData = $this->getVarInt();
|
$this->eventData = $this->getVarInt();
|
||||||
$this->type = $this->getByte();
|
$this->type = $this->getByte();
|
||||||
@ -53,7 +53,7 @@ class EventPacket extends DataPacket{
|
|||||||
//TODO: nice confusing mess
|
//TODO: nice confusing mess
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->playerRuntimeId);
|
$this->putEntityRuntimeId($this->playerRuntimeId);
|
||||||
$this->putVarInt($this->eventData);
|
$this->putVarInt($this->eventData);
|
||||||
$this->putByte($this->type);
|
$this->putByte($this->type);
|
||||||
|
@ -45,7 +45,7 @@ class ExplodePacket extends DataPacket{
|
|||||||
return parent::clean();
|
return parent::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->radius = (float) ($this->getVarInt() / 32);
|
$this->radius = (float) ($this->getVarInt() / 32);
|
||||||
$count = $this->getUnsignedVarInt();
|
$count = $this->getUnsignedVarInt();
|
||||||
@ -56,7 +56,7 @@ class ExplodePacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putVarInt((int) ($this->radius * 32));
|
$this->putVarInt((int) ($this->radius * 32));
|
||||||
$this->putUnsignedVarInt(count($this->records));
|
$this->putUnsignedVarInt(count($this->records));
|
||||||
|
@ -35,13 +35,13 @@ class FullChunkDataPacket extends DataPacket{
|
|||||||
public $chunkZ;
|
public $chunkZ;
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->chunkX = $this->getVarInt();
|
$this->chunkX = $this->getVarInt();
|
||||||
$this->chunkZ = $this->getVarInt();
|
$this->chunkZ = $this->getVarInt();
|
||||||
$this->data = $this->getString();
|
$this->data = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->chunkX);
|
$this->putVarInt($this->chunkX);
|
||||||
$this->putVarInt($this->chunkZ);
|
$this->putVarInt($this->chunkZ);
|
||||||
$this->putString($this->data);
|
$this->putString($this->data);
|
||||||
|
@ -32,11 +32,11 @@ class GameRulesChangedPacket extends DataPacket{
|
|||||||
|
|
||||||
public $gameRules = [];
|
public $gameRules = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->gameRules = $this->getGameRules();
|
$this->gameRules = $this->getGameRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putGameRules($this->gameRules);
|
$this->putGameRules($this->gameRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class GuiDataPickItemPacket extends DataPacket{
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public $hotbarSlot;
|
public $hotbarSlot;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->hotbarSlot = $this->getLInt();
|
$this->hotbarSlot = $this->getLInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putLInt($this->hotbarSlot);
|
$this->putLInt($this->hotbarSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class HurtArmorPacket extends DataPacket{
|
|||||||
|
|
||||||
public $health;
|
public $health;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->health = $this->getVarInt();
|
$this->health = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->health);
|
$this->putVarInt($this->health);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class InteractPacket extends DataPacket{
|
|||||||
/** @var float */
|
/** @var float */
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->action = $this->getByte();
|
$this->action = $this->getByte();
|
||||||
$this->target = $this->getEntityRuntimeId();
|
$this->target = $this->getEntityRuntimeId();
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ class InteractPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->action);
|
$this->putByte($this->action);
|
||||||
$this->putEntityRuntimeId($this->target);
|
$this->putEntityRuntimeId($this->target);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class InventoryContentPacket extends DataPacket{
|
|||||||
/** @var Item[] */
|
/** @var Item[] */
|
||||||
public $items = [];
|
public $items = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->windowId = $this->getUnsignedVarInt();
|
$this->windowId = $this->getUnsignedVarInt();
|
||||||
$count = $this->getUnsignedVarInt();
|
$count = $this->getUnsignedVarInt();
|
||||||
for($i = 0; $i < $count; ++$i){
|
for($i = 0; $i < $count; ++$i){
|
||||||
@ -44,7 +44,7 @@ class InventoryContentPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt($this->windowId);
|
$this->putUnsignedVarInt($this->windowId);
|
||||||
$this->putUnsignedVarInt(count($this->items));
|
$this->putUnsignedVarInt(count($this->items));
|
||||||
foreach($this->items as $item){
|
foreach($this->items as $item){
|
||||||
|
@ -38,13 +38,13 @@ class InventorySlotPacket extends DataPacket{
|
|||||||
/** @var Item */
|
/** @var Item */
|
||||||
public $item;
|
public $item;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->windowId = $this->getUnsignedVarInt();
|
$this->windowId = $this->getUnsignedVarInt();
|
||||||
$this->inventorySlot = $this->getUnsignedVarInt();
|
$this->inventorySlot = $this->getUnsignedVarInt();
|
||||||
$this->item = $this->getSlot();
|
$this->item = $this->getSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt($this->windowId);
|
$this->putUnsignedVarInt($this->windowId);
|
||||||
$this->putUnsignedVarInt($this->inventorySlot);
|
$this->putUnsignedVarInt($this->inventorySlot);
|
||||||
$this->putSlot($this->item);
|
$this->putSlot($this->item);
|
||||||
|
@ -85,7 +85,7 @@ class InventoryTransactionPacket extends DataPacket{
|
|||||||
|
|
||||||
public $transactionData;
|
public $transactionData;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$type = $this->getUnsignedVarInt();
|
$type = $this->getUnsignedVarInt();
|
||||||
|
|
||||||
$actionCount = $this->getUnsignedVarInt();
|
$actionCount = $this->getUnsignedVarInt();
|
||||||
@ -133,7 +133,7 @@ class InventoryTransactionPacket extends DataPacket{
|
|||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ class ItemFrameDropItemPacket extends DataPacket{
|
|||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,13 +106,13 @@ class LevelEventPacket extends DataPacket{
|
|||||||
public $z = 0;
|
public $z = 0;
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->evid = $this->getVarInt();
|
$this->evid = $this->getVarInt();
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->data = $this->getVarInt();
|
$this->data = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->evid);
|
$this->putVarInt($this->evid);
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putVarInt($this->data);
|
$this->putVarInt($this->data);
|
||||||
|
@ -201,7 +201,7 @@ class LevelSoundEventPacket extends DataPacket{
|
|||||||
public $unknownBool = false;
|
public $unknownBool = false;
|
||||||
public $disableRelativeVolume = false;
|
public $disableRelativeVolume = false;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->sound = $this->getByte();
|
$this->sound = $this->getByte();
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->extraData = $this->getVarInt();
|
$this->extraData = $this->getVarInt();
|
||||||
@ -210,7 +210,7 @@ class LevelSoundEventPacket extends DataPacket{
|
|||||||
$this->disableRelativeVolume = $this->getBool();
|
$this->disableRelativeVolume = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->sound);
|
$this->putByte($this->sound);
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putVarInt($this->extraData);
|
$this->putVarInt($this->extraData);
|
||||||
|
@ -55,7 +55,7 @@ class LoginPacket extends DataPacket{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->protocol = $this->getInt();
|
$this->protocol = $this->getInt();
|
||||||
|
|
||||||
if($this->protocol !== ProtocolInfo::CURRENT_PROTOCOL){
|
if($this->protocol !== ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
@ -93,7 +93,7 @@ class LoginPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,11 @@ class MapInfoRequestPacket extends DataPacket{
|
|||||||
|
|
||||||
public $mapId;
|
public $mapId;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->mapId = $this->getEntityUniqueId();
|
$this->mapId = $this->getEntityUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->mapId);
|
$this->putEntityUniqueId($this->mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class MobArmorEquipmentPacket extends DataPacket{
|
|||||||
/** @var Item[] */
|
/** @var Item[] */
|
||||||
public $slots = [];
|
public $slots = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->slots[0] = $this->getSlot();
|
$this->slots[0] = $this->getSlot();
|
||||||
$this->slots[1] = $this->getSlot();
|
$this->slots[1] = $this->getSlot();
|
||||||
@ -44,7 +44,7 @@ class MobArmorEquipmentPacket extends DataPacket{
|
|||||||
$this->slots[3] = $this->getSlot();
|
$this->slots[3] = $this->getSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putSlot($this->slots[0]);
|
$this->putSlot($this->slots[0]);
|
||||||
$this->putSlot($this->slots[1]);
|
$this->putSlot($this->slots[1]);
|
||||||
|
@ -42,7 +42,7 @@ class MobEffectPacket extends DataPacket{
|
|||||||
public $particles = true;
|
public $particles = true;
|
||||||
public $duration = 0;
|
public $duration = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->eventId = $this->getByte();
|
$this->eventId = $this->getByte();
|
||||||
$this->effectId = $this->getVarInt();
|
$this->effectId = $this->getVarInt();
|
||||||
@ -51,7 +51,7 @@ class MobEffectPacket extends DataPacket{
|
|||||||
$this->duration = $this->getVarInt();
|
$this->duration = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putByte($this->eventId);
|
$this->putByte($this->eventId);
|
||||||
$this->putVarInt($this->effectId);
|
$this->putVarInt($this->effectId);
|
||||||
|
@ -37,7 +37,7 @@ class MobEquipmentPacket extends DataPacket{
|
|||||||
public $hotbarSlot;
|
public $hotbarSlot;
|
||||||
public $windowId = 0;
|
public $windowId = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->item = $this->getSlot();
|
$this->item = $this->getSlot();
|
||||||
$this->inventorySlot = $this->getByte();
|
$this->inventorySlot = $this->getByte();
|
||||||
@ -45,7 +45,7 @@ class MobEquipmentPacket extends DataPacket{
|
|||||||
$this->windowId = $this->getByte();
|
$this->windowId = $this->getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putSlot($this->item);
|
$this->putSlot($this->item);
|
||||||
$this->putByte($this->inventorySlot);
|
$this->putByte($this->inventorySlot);
|
||||||
|
@ -35,12 +35,12 @@ class ModalFormRequestPacket extends DataPacket{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $formData; //json
|
public $formData; //json
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->formId = $this->getUnsignedVarInt();
|
$this->formId = $this->getUnsignedVarInt();
|
||||||
$this->formData = $this->getString();
|
$this->formData = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt($this->formId);
|
$this->putUnsignedVarInt($this->formId);
|
||||||
$this->putString($this->formData);
|
$this->putString($this->formData);
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
|||||||
class ModalFormResponsePacket extends DataPacket{
|
class ModalFormResponsePacket extends DataPacket{
|
||||||
const NETWORK_ID = ProtocolInfo::MODAL_FORM_RESPONSE_PACKET;
|
const NETWORK_ID = ProtocolInfo::MODAL_FORM_RESPONSE_PACKET;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class MoveEntityPacket extends DataPacket{
|
|||||||
public $onGround = false;
|
public $onGround = false;
|
||||||
public $teleported = false;
|
public $teleported = false;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->pitch = $this->getByteRotation();
|
$this->pitch = $this->getByteRotation();
|
||||||
@ -51,7 +51,7 @@ class MoveEntityPacket extends DataPacket{
|
|||||||
$this->teleported = $this->getBool();
|
$this->teleported = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putByteRotation($this->pitch);
|
$this->putByteRotation($this->pitch);
|
||||||
|
@ -49,7 +49,7 @@ class MovePlayerPacket extends DataPacket{
|
|||||||
public $int1 = 0;
|
public $int1 = 0;
|
||||||
public $int2 = 0;
|
public $int2 = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->pitch = $this->getLFloat();
|
$this->pitch = $this->getLFloat();
|
||||||
@ -64,7 +64,7 @@ class MovePlayerPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putLFloat($this->pitch);
|
$this->putLFloat($this->pitch);
|
||||||
|
@ -39,14 +39,14 @@ class NpcRequestPacket extends DataPacket{
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public $actionType;
|
public $actionType;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->requestType = $this->getByte();
|
$this->requestType = $this->getByte();
|
||||||
$this->commandString = $this->getString();
|
$this->commandString = $this->getString();
|
||||||
$this->actionType = $this->getByte();
|
$this->actionType = $this->getByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putByte($this->requestType);
|
$this->putByte($this->requestType);
|
||||||
$this->putString($this->commandString);
|
$this->putString($this->commandString);
|
||||||
|
@ -37,13 +37,13 @@ class PhotoTransferPacket extends DataPacket{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $string3;
|
public $string3;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->string1 = $this->getString();
|
$this->string1 = $this->getString();
|
||||||
$this->string2 = $this->getString();
|
$this->string2 = $this->getString();
|
||||||
$this->string3 = $this->getString();
|
$this->string3 = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->string1);
|
$this->putString($this->string1);
|
||||||
$this->putString($this->string2);
|
$this->putString($this->string2);
|
||||||
$this->putString($this->string3);
|
$this->putString($this->string3);
|
||||||
|
@ -39,14 +39,14 @@ class PlaySoundPacket extends DataPacket{
|
|||||||
public $volume;
|
public $volume;
|
||||||
public $pitch;
|
public $pitch;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->soundName = $this->getString();
|
$this->soundName = $this->getString();
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->volume = $this->getLFloat();
|
$this->volume = $this->getLFloat();
|
||||||
$this->pitch = $this->getLFloat();
|
$this->pitch = $this->getLFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->soundName);
|
$this->putString($this->soundName);
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->putLFloat($this->volume);
|
$this->putLFloat($this->volume);
|
||||||
|
@ -41,7 +41,7 @@ class PlayStatusPacket extends DataPacket{
|
|||||||
|
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->status = $this->getInt();
|
$this->status = $this->getInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class PlayStatusPacket extends DataPacket{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putInt($this->status);
|
$this->putInt($this->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,14 +61,14 @@ class PlayerActionPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $face;
|
public $face;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->action = $this->getVarInt();
|
$this->action = $this->getVarInt();
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->face = $this->getVarInt();
|
$this->face = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putVarInt($this->action);
|
$this->putVarInt($this->action);
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
|
@ -38,7 +38,7 @@ class PlayerHotbarPacket extends DataPacket{
|
|||||||
/** @var int[] */
|
/** @var int[] */
|
||||||
public $slots = [];
|
public $slots = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->selectedSlot = $this->getUnsignedVarInt();
|
$this->selectedSlot = $this->getUnsignedVarInt();
|
||||||
$this->windowId = $this->getByte();
|
$this->windowId = $this->getByte();
|
||||||
$count = $this->getUnsignedVarInt();
|
$count = $this->getUnsignedVarInt();
|
||||||
@ -47,7 +47,7 @@ class PlayerHotbarPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt($this->selectedSlot);
|
$this->putUnsignedVarInt($this->selectedSlot);
|
||||||
$this->putByte($this->windowId);
|
$this->putByte($this->windowId);
|
||||||
$this->putUnsignedVarInt(count($this->slots));
|
$this->putUnsignedVarInt(count($this->slots));
|
||||||
|
@ -36,14 +36,14 @@ class PlayerInputPacket extends DataPacket{
|
|||||||
public $unknownBool1;
|
public $unknownBool1;
|
||||||
public $unknownBool2;
|
public $unknownBool2;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->motionX = $this->getLFloat();
|
$this->motionX = $this->getLFloat();
|
||||||
$this->motionY = $this->getLFloat();
|
$this->motionY = $this->getLFloat();
|
||||||
$this->unknownBool1 = $this->getBool();
|
$this->unknownBool1 = $this->getBool();
|
||||||
$this->unknownBool2 = $this->getBool();
|
$this->unknownBool2 = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putLFloat($this->motionX);
|
$this->putLFloat($this->motionX);
|
||||||
$this->putLFloat($this->motionY);
|
$this->putLFloat($this->motionY);
|
||||||
$this->putBool($this->unknownBool1);
|
$this->putBool($this->unknownBool1);
|
||||||
|
@ -44,7 +44,7 @@ class PlayerListPacket extends DataPacket{
|
|||||||
return parent::clean();
|
return parent::clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->type = $this->getByte();
|
$this->type = $this->getByte();
|
||||||
$count = $this->getUnsignedVarInt();
|
$count = $this->getUnsignedVarInt();
|
||||||
for($i = 0; $i < $count; ++$i){
|
for($i = 0; $i < $count; ++$i){
|
||||||
@ -63,7 +63,7 @@ class PlayerListPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->type);
|
$this->putByte($this->type);
|
||||||
$this->putUnsignedVarInt(count($this->entries));
|
$this->putUnsignedVarInt(count($this->entries));
|
||||||
foreach($this->entries as $d){
|
foreach($this->entries as $d){
|
||||||
|
@ -49,7 +49,7 @@ class PlayerSkinPacket extends DataPacket{
|
|||||||
public $geometryData;
|
public $geometryData;
|
||||||
|
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->uuid = $this->getUUID();
|
$this->uuid = $this->getUUID();
|
||||||
$this->skinId = $this->getString();
|
$this->skinId = $this->getString();
|
||||||
$this->skinName = $this->getString();
|
$this->skinName = $this->getString();
|
||||||
@ -60,7 +60,7 @@ class PlayerSkinPacket extends DataPacket{
|
|||||||
$this->geometryData = $this->getString();
|
$this->geometryData = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUUID($this->uuid);
|
$this->putUUID($this->uuid);
|
||||||
$this->putString($this->skinId);
|
$this->putString($this->skinId);
|
||||||
$this->putString($this->skinName);
|
$this->putString($this->skinName);
|
||||||
|
@ -33,14 +33,14 @@ class PurchaseReceiptPacket extends DataPacket{
|
|||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
public $entries = [];
|
public $entries = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$count = $this->getUnsignedVarInt();
|
$count = $this->getUnsignedVarInt();
|
||||||
for($i = 0; $i < $count; ++$i){
|
for($i = 0; $i < $count; ++$i){
|
||||||
$this->entries[] = $this->getString();
|
$this->entries[] = $this->getString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt(count($this->entries));
|
$this->putUnsignedVarInt(count($this->entries));
|
||||||
foreach($this->entries as $entry){
|
foreach($this->entries as $entry){
|
||||||
$this->putString($entry);
|
$this->putString($entry);
|
||||||
|
@ -38,11 +38,11 @@ class RemoveBlockPacket extends DataPacket{
|
|||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class RemoveEntityPacket extends DataPacket{
|
|||||||
|
|
||||||
public $entityUniqueId;
|
public $entityUniqueId;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId);
|
$this->putEntityUniqueId($this->entityUniqueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class RequestChunkRadiusPacket extends DataPacket{
|
|||||||
|
|
||||||
public $radius;
|
public $radius;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->radius = $this->getVarInt();
|
$this->radius = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->radius);
|
$this->putVarInt($this->radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,14 +37,14 @@ class ResourcePackChunkDataPacket extends DataPacket{
|
|||||||
public $progress;
|
public $progress;
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->packId = $this->getString();
|
$this->packId = $this->getString();
|
||||||
$this->chunkIndex = $this->getLInt();
|
$this->chunkIndex = $this->getLInt();
|
||||||
$this->progress = $this->getLLong();
|
$this->progress = $this->getLLong();
|
||||||
$this->data = $this->get($this->getLInt());
|
$this->data = $this->get($this->getLInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->packId);
|
$this->putString($this->packId);
|
||||||
$this->putLInt($this->chunkIndex);
|
$this->putLInt($this->chunkIndex);
|
||||||
$this->putLLong($this->progress);
|
$this->putLLong($this->progress);
|
||||||
|
@ -35,12 +35,12 @@ class ResourcePackChunkRequestPacket extends DataPacket{
|
|||||||
public $packId;
|
public $packId;
|
||||||
public $chunkIndex;
|
public $chunkIndex;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->packId = $this->getString();
|
$this->packId = $this->getString();
|
||||||
$this->chunkIndex = $this->getLInt();
|
$this->chunkIndex = $this->getLInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->packId);
|
$this->putString($this->packId);
|
||||||
$this->putLInt($this->chunkIndex);
|
$this->putLInt($this->chunkIndex);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class ResourcePackClientResponsePacket extends DataPacket{
|
|||||||
public $status;
|
public $status;
|
||||||
public $packIds = [];
|
public $packIds = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->status = $this->getByte();
|
$this->status = $this->getByte();
|
||||||
$entryCount = $this->getLShort();
|
$entryCount = $this->getLShort();
|
||||||
while($entryCount-- > 0){
|
while($entryCount-- > 0){
|
||||||
@ -47,7 +47,7 @@ class ResourcePackClientResponsePacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putByte($this->status);
|
$this->putByte($this->status);
|
||||||
$this->putLShort(count($this->packIds));
|
$this->putLShort(count($this->packIds));
|
||||||
foreach($this->packIds as $id){
|
foreach($this->packIds as $id){
|
||||||
|
@ -38,7 +38,7 @@ class ResourcePackDataInfoPacket extends DataPacket{
|
|||||||
public $compressedPackSize;
|
public $compressedPackSize;
|
||||||
public $sha256;
|
public $sha256;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->packId = $this->getString();
|
$this->packId = $this->getString();
|
||||||
$this->maxChunkSize = $this->getLInt();
|
$this->maxChunkSize = $this->getLInt();
|
||||||
$this->chunkCount = $this->getLInt();
|
$this->chunkCount = $this->getLInt();
|
||||||
@ -46,7 +46,7 @@ class ResourcePackDataInfoPacket extends DataPacket{
|
|||||||
$this->sha256 = $this->getString();
|
$this->sha256 = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->packId);
|
$this->putString($this->packId);
|
||||||
$this->putLInt($this->maxChunkSize);
|
$this->putLInt($this->maxChunkSize);
|
||||||
$this->putLInt($this->chunkCount);
|
$this->putLInt($this->chunkCount);
|
||||||
|
@ -41,7 +41,7 @@ class ResourcePackStackPacket extends DataPacket{
|
|||||||
/** @var ResourcePack[] */
|
/** @var ResourcePack[] */
|
||||||
public $resourcePackStack = [];
|
public $resourcePackStack = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
/*$this->mustAccept = $this->getBool();
|
/*$this->mustAccept = $this->getBool();
|
||||||
$behaviorPackCount = $this->getUnsignedVarInt();
|
$behaviorPackCount = $this->getUnsignedVarInt();
|
||||||
while($behaviorPackCount-- > 0){
|
while($behaviorPackCount-- > 0){
|
||||||
@ -58,7 +58,7 @@ class ResourcePackStackPacket extends DataPacket{
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBool($this->mustAccept);
|
$this->putBool($this->mustAccept);
|
||||||
|
|
||||||
$this->putUnsignedVarInt(count($this->behaviorPackStack));
|
$this->putUnsignedVarInt(count($this->behaviorPackStack));
|
||||||
|
@ -39,7 +39,7 @@ class ResourcePacksInfoPacket extends DataPacket{
|
|||||||
/** @var ResourcePack[] */
|
/** @var ResourcePack[] */
|
||||||
public $resourcePackEntries = [];
|
public $resourcePackEntries = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
/*$this->mustAccept = $this->getBool();
|
/*$this->mustAccept = $this->getBool();
|
||||||
$behaviorPackCount = $this->getLShort();
|
$behaviorPackCount = $this->getLShort();
|
||||||
while($behaviorPackCount-- > 0){
|
while($behaviorPackCount-- > 0){
|
||||||
@ -60,7 +60,7 @@ class ResourcePacksInfoPacket extends DataPacket{
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
|
|
||||||
$this->putBool($this->mustAccept);
|
$this->putBool($this->mustAccept);
|
||||||
$this->putLShort(count($this->behaviorPackEntries));
|
$this->putLShort(count($this->behaviorPackEntries));
|
||||||
|
@ -35,11 +35,11 @@ class RespawnPacket extends DataPacket{
|
|||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,11 @@ class RiderJumpPacket extends DataPacket{
|
|||||||
|
|
||||||
public $unknown;
|
public $unknown;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->unknown = $this->getVarInt();
|
$this->unknown = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->unknown);
|
$this->putVarInt($this->unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
|||||||
class ServerSettingsRequestPacket extends DataPacket{
|
class ServerSettingsRequestPacket extends DataPacket{
|
||||||
const NETWORK_ID = ProtocolInfo::SERVER_SETTINGS_REQUEST_PACKET;
|
const NETWORK_ID = ProtocolInfo::SERVER_SETTINGS_REQUEST_PACKET;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
//No payload
|
//No payload
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//No payload
|
//No payload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ class ServerSettingsResponsePacket extends DataPacket{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $formData; //json
|
public $formData; //json
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->formId = $this->getUnsignedVarInt();
|
$this->formId = $this->getUnsignedVarInt();
|
||||||
$this->formData = $this->getString();
|
$this->formData = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt($this->formId);
|
$this->putUnsignedVarInt($this->formId);
|
||||||
$this->putString($this->formData);
|
$this->putString($this->formData);
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,11 @@ class ServerToClientHandshakePacket extends DataPacket{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->jwt = $this->getString();
|
$this->jwt = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->jwt);
|
$this->putString($this->jwt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class SetCommandsEnabledPacket extends DataPacket{
|
|||||||
|
|
||||||
public $enabled;
|
public $enabled;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->enabled = $this->getBool();
|
$this->enabled = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putBool($this->enabled);
|
$this->putBool($this->enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class SetDifficultyPacket extends DataPacket{
|
|||||||
|
|
||||||
public $difficulty;
|
public $difficulty;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->difficulty = $this->getUnsignedVarInt();
|
$this->difficulty = $this->getUnsignedVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putUnsignedVarInt($this->difficulty);
|
$this->putUnsignedVarInt($this->difficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,12 +34,12 @@ class SetEntityDataPacket extends DataPacket{
|
|||||||
public $entityRuntimeId;
|
public $entityRuntimeId;
|
||||||
public $metadata;
|
public $metadata;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->metadata = $this->getEntityMetadata();
|
$this->metadata = $this->getEntityMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putEntityMetadata($this->metadata);
|
$this->putEntityMetadata($this->metadata);
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,11 @@ class SetEntityLinkPacket extends DataPacket{
|
|||||||
/** @var array [from, to, type, unknown byte] */
|
/** @var array [from, to, type, unknown byte] */
|
||||||
public $link = [];
|
public $link = [];
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->link = $this->getEntityLink();
|
$this->link = $this->getEntityLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityLink($this->link);
|
$this->putEntityLink($this->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ class SetEntityMotionPacket extends DataPacket{
|
|||||||
public $motionY;
|
public $motionY;
|
||||||
public $motionZ;
|
public $motionZ;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->getVector3f($this->motionX, $this->motionY, $this->motionZ);
|
$this->getVector3f($this->motionX, $this->motionY, $this->motionZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putVector3f($this->motionX, $this->motionY, $this->motionZ);
|
$this->putVector3f($this->motionX, $this->motionY, $this->motionZ);
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ class SetHealthPacket extends DataPacket{
|
|||||||
|
|
||||||
public $health;
|
public $health;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->health = $this->getVarInt();
|
$this->health = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->health);
|
$this->putVarInt($this->health);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ class SetLastHurtByPacket extends DataPacket{
|
|||||||
|
|
||||||
public $entityTypeId;
|
public $entityTypeId;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityTypeId = $this->getVarInt();
|
$this->entityTypeId = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->entityTypeId);
|
$this->putVarInt($this->entityTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class SetPlayerGameTypePacket extends DataPacket{
|
|||||||
|
|
||||||
public $gamemode;
|
public $gamemode;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->gamemode = $this->getVarInt();
|
$this->gamemode = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->gamemode);
|
$this->putVarInt($this->gamemode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,13 +40,13 @@ class SetSpawnPositionPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $spawnForced;
|
public $spawnForced;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->spawnType = $this->getVarInt();
|
$this->spawnType = $this->getVarInt();
|
||||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->spawnForced = $this->getBool();
|
$this->spawnForced = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->spawnType);
|
$this->putVarInt($this->spawnType);
|
||||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||||
$this->putBool($this->spawnForced);
|
$this->putBool($this->spawnForced);
|
||||||
|
@ -32,11 +32,11 @@ class SetTimePacket extends DataPacket{
|
|||||||
|
|
||||||
public $time;
|
public $time;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->time = $this->getVarInt();
|
$this->time = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->time);
|
$this->putVarInt($this->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class SetTitlePacket extends DataPacket{
|
|||||||
public $stayTime = 0;
|
public $stayTime = 0;
|
||||||
public $fadeOutTime = 0;
|
public $fadeOutTime = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->type = $this->getVarInt();
|
$this->type = $this->getVarInt();
|
||||||
$this->text = $this->getString();
|
$this->text = $this->getString();
|
||||||
$this->fadeInTime = $this->getVarInt();
|
$this->fadeInTime = $this->getVarInt();
|
||||||
@ -53,7 +53,7 @@ class SetTitlePacket extends DataPacket{
|
|||||||
$this->fadeOutTime = $this->getVarInt();
|
$this->fadeOutTime = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVarInt($this->type);
|
$this->putVarInt($this->type);
|
||||||
$this->putString($this->text);
|
$this->putString($this->text);
|
||||||
$this->putVarInt($this->fadeInTime);
|
$this->putVarInt($this->fadeInTime);
|
||||||
|
@ -38,12 +38,12 @@ class ShowCreditsPacket extends DataPacket{
|
|||||||
public $playerEid;
|
public $playerEid;
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->playerEid = $this->getEntityRuntimeId();
|
$this->playerEid = $this->getEntityRuntimeId();
|
||||||
$this->status = $this->getVarInt();
|
$this->status = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityRuntimeId($this->playerEid);
|
$this->putEntityRuntimeId($this->playerEid);
|
||||||
$this->putVarInt($this->status);
|
$this->putVarInt($this->status);
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
|||||||
class ShowProfilePacket extends DataPacket{
|
class ShowProfilePacket extends DataPacket{
|
||||||
const NETWORK_ID = ProtocolInfo::SHOW_PROFILE_PACKET;
|
const NETWORK_ID = ProtocolInfo::SHOW_PROFILE_PACKET;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ class ShowStoreOfferPacket extends DataPacket{
|
|||||||
|
|
||||||
public $offerId;
|
public $offerId;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->offerId = $this->getString();
|
$this->offerId = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->offerId);
|
$this->putString($this->offerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ class SimpleEventPacket extends DataPacket{
|
|||||||
|
|
||||||
public $unknownShort1;
|
public $unknownShort1;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->unknownShort1 = $this->getLShort();
|
$this->unknownShort1 = $this->getLShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putLShort($this->unknownShort1);
|
$this->putLShort($this->unknownShort1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ class SpawnExperienceOrbPacket extends DataPacket{
|
|||||||
public $z;
|
public $z;
|
||||||
public $amount;
|
public $amount;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->amount = $this->getVarInt();
|
$this->amount = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putVarInt($this->amount);
|
$this->putVarInt($this->amount);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class StartGamePacket extends DataPacket{
|
|||||||
|
|
||||||
public $unknownVarInt = 0;
|
public $unknownVarInt = 0;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->playerGamemode = $this->getVarInt();
|
$this->playerGamemode = $this->getVarInt();
|
||||||
@ -117,7 +117,7 @@ class StartGamePacket extends DataPacket{
|
|||||||
$this->unknownVarInt = $this->getVarInt();
|
$this->unknownVarInt = $this->getVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putEntityUniqueId($this->entityUniqueId);
|
$this->putEntityUniqueId($this->entityUniqueId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
$this->putVarInt($this->playerGamemode);
|
$this->putVarInt($this->playerGamemode);
|
||||||
|
@ -35,12 +35,12 @@ class StopSoundPacket extends DataPacket{
|
|||||||
public $soundName;
|
public $soundName;
|
||||||
public $stopAll;
|
public $stopAll;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
$this->soundName = $this->getString();
|
$this->soundName = $this->getString();
|
||||||
$this->stopAll = $this->getBool();
|
$this->stopAll = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
$this->putString($this->soundName);
|
$this->putString($this->soundName);
|
||||||
$this->putBool($this->stopAll);
|
$this->putBool($this->stopAll);
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
|
|||||||
class StructureBlockUpdatePacket extends DataPacket{
|
class StructureBlockUpdatePacket extends DataPacket{
|
||||||
const NETWORK_ID = ProtocolInfo::STRUCTURE_BLOCK_UPDATE_PACKET;
|
const NETWORK_ID = ProtocolInfo::STRUCTURE_BLOCK_UPDATE_PACKET;
|
||||||
|
|
||||||
public function decodePayload(){
|
protected function decodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encodePayload(){
|
protected function encodePayload(){
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user