diff --git a/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php b/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php index 679be54cf..705d612e9 100644 --- a/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddEntityPacket.php @@ -49,7 +49,7 @@ class AddEntityPacket extends DataPacket{ public $metadata = []; public $links = []; - public function decode(){ + public function decodePayload(){ $this->entityUniqueId = $this->getEntityUniqueId(); $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->type = $this->getUnsignedVarInt(); @@ -85,8 +85,7 @@ class AddEntityPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId); $this->putEntityRuntimeId($this->entityRuntimeId); $this->putUnsignedVarInt($this->type); diff --git a/src/pocketmine/network/mcpe/protocol/AddHangingEntityPacket.php b/src/pocketmine/network/mcpe/protocol/AddHangingEntityPacket.php index fb36ffd6a..3841fbfe0 100644 --- a/src/pocketmine/network/mcpe/protocol/AddHangingEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddHangingEntityPacket.php @@ -37,15 +37,14 @@ class AddHangingEntityPacket extends DataPacket{ public $z; public $unknown; //TODO (rotation?) - public function decode(){ + public function decodePayload(){ $this->entityUniqueId = $this->getEntityUniqueId(); $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->getBlockPosition($this->x, $this->y, $this->z); $this->unknown = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->entityUniqueId); $this->putEntityRuntimeId($this->entityRuntimeId); $this->putBlockPosition($this->x, $this->y, $this->z); diff --git a/src/pocketmine/network/mcpe/protocol/AddItemEntityPacket.php b/src/pocketmine/network/mcpe/protocol/AddItemEntityPacket.php index 00c8cdd45..55f2a5ac5 100644 --- a/src/pocketmine/network/mcpe/protocol/AddItemEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddItemEntityPacket.php @@ -44,7 +44,7 @@ class AddItemEntityPacket extends DataPacket{ public $speedZ = 0.0; public $metadata = []; - public function decode(){ + public function decodePayload(){ $this->entityUniqueId = $this->getEntityUniqueId(); $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->item = $this->getSlot(); @@ -53,8 +53,7 @@ class AddItemEntityPacket extends DataPacket{ $this->metadata = $this->getEntityMetadata(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId); $this->putEntityRuntimeId($this->entityRuntimeId); $this->putSlot($this->item); diff --git a/src/pocketmine/network/mcpe/protocol/AddItemPacket.php b/src/pocketmine/network/mcpe/protocol/AddItemPacket.php index d0b59dd85..30d3cdd38 100644 --- a/src/pocketmine/network/mcpe/protocol/AddItemPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddItemPacket.php @@ -33,12 +33,11 @@ class AddItemPacket extends DataPacket{ public $item; - public function decode(){ + public function decodePayload(){ $this->item = $this->getSlot(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putSlot($this->item); } diff --git a/src/pocketmine/network/mcpe/protocol/AddPaintingPacket.php b/src/pocketmine/network/mcpe/protocol/AddPaintingPacket.php index 8f69d7e57..602af28d9 100644 --- a/src/pocketmine/network/mcpe/protocol/AddPaintingPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddPaintingPacket.php @@ -41,7 +41,7 @@ class AddPaintingPacket extends DataPacket{ public $direction; public $title; - public function decode(){ + public function decodePayload(){ $this->entityUniqueId = $this->getEntityUniqueId(); $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->getBlockPosition($this->x, $this->y, $this->z); @@ -49,8 +49,7 @@ class AddPaintingPacket extends DataPacket{ $this->title = $this->getString(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId); $this->putEntityRuntimeId($this->entityRuntimeId); $this->putBlockPosition($this->x, $this->y, $this->z); diff --git a/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php b/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php index e90f8dbb6..b1e8af929 100644 --- a/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AddPlayerPacket.php @@ -53,7 +53,7 @@ class AddPlayerPacket extends DataPacket{ public $item; public $metadata = []; - public function decode(){ + public function decodePayload(){ $this->uuid = $this->getUUID(); $this->username = $this->getString(); $this->entityUniqueId = $this->getEntityUniqueId(); @@ -67,8 +67,7 @@ class AddPlayerPacket extends DataPacket{ $this->metadata = $this->getEntityMetadata(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putUUID($this->uuid); $this->putString($this->username); $this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId); diff --git a/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php b/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php index b660c22dc..839023311 100644 --- a/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php @@ -52,7 +52,7 @@ class AdventureSettingsPacket extends DataPacket{ public $flags = 0; public $userPermission; - public function decode(){ + public function decodePayload(){ $this->flags = $this->getUnsignedVarInt(); $this->userPermission = $this->getUnsignedVarInt(); @@ -69,9 +69,7 @@ class AdventureSettingsPacket extends DataPacket{ $this->muted = (bool) ($this->flags & (1 << 10)); } - public function encode(){ - $this->reset(); - + public function encodePayload(){ $this->flags |= ((int) $this->worldImmutable); $this->flags |= ((int) $this->noPvp) << 1; $this->flags |= ((int) $this->noPvm) << 2; diff --git a/src/pocketmine/network/mcpe/protocol/AnimatePacket.php b/src/pocketmine/network/mcpe/protocol/AnimatePacket.php index b0427276a..f92c9d764 100644 --- a/src/pocketmine/network/mcpe/protocol/AnimatePacket.php +++ b/src/pocketmine/network/mcpe/protocol/AnimatePacket.php @@ -35,7 +35,7 @@ class AnimatePacket extends DataPacket{ public $entityRuntimeId; public $float; //TODO (Boat rowing time?) - public function decode(){ + public function decodePayload(){ $this->action = $this->getVarInt(); $this->entityRuntimeId = $this->getEntityRuntimeId(); if($this->action & 0x80){ @@ -43,8 +43,7 @@ class AnimatePacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->action); $this->putEntityRuntimeId($this->entityRuntimeId); if($this->action & 0x80){ diff --git a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php index 5cbadd2f7..f532d6f54 100644 --- a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php @@ -33,13 +33,12 @@ class AvailableCommandsPacket extends DataPacket{ public $commands; //JSON-encoded command data public $unknown = ""; - public function decode(){ + public function decodePayload(){ $this->commands = $this->getString(); $this->unknown = $this->getString(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->commands); $this->putString($this->unknown); } diff --git a/src/pocketmine/network/mcpe/protocol/BatchPacket.php b/src/pocketmine/network/mcpe/protocol/BatchPacket.php index 06124eafd..21962fc05 100644 --- a/src/pocketmine/network/mcpe/protocol/BatchPacket.php +++ b/src/pocketmine/network/mcpe/protocol/BatchPacket.php @@ -45,12 +45,11 @@ class BatchPacket extends DataPacket{ return true; } - public function decode(){ + public function decodePayload(){ $this->payload = $this->getRemaining(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ assert($this->compressed); $this->put($this->payload); } diff --git a/src/pocketmine/network/mcpe/protocol/BlockEntityDataPacket.php b/src/pocketmine/network/mcpe/protocol/BlockEntityDataPacket.php index 2b138307a..40cacd7dc 100644 --- a/src/pocketmine/network/mcpe/protocol/BlockEntityDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/BlockEntityDataPacket.php @@ -36,13 +36,12 @@ class BlockEntityDataPacket extends DataPacket{ public $z; public $namedtag; - public function decode(){ + public function decodePayload(){ $this->getBlockPosition($this->x, $this->y, $this->z); $this->namedtag = $this->getRemaining(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBlockPosition($this->x, $this->y, $this->z); $this->put($this->namedtag); } diff --git a/src/pocketmine/network/mcpe/protocol/BlockEventPacket.php b/src/pocketmine/network/mcpe/protocol/BlockEventPacket.php index bf83d3b3a..6bc54cf08 100644 --- a/src/pocketmine/network/mcpe/protocol/BlockEventPacket.php +++ b/src/pocketmine/network/mcpe/protocol/BlockEventPacket.php @@ -37,14 +37,13 @@ class BlockEventPacket extends DataPacket{ public $case1; public $case2; - public function decode(){ + public function decodePayload(){ $this->getBlockPosition($this->x, $this->y, $this->z); $this->case1 = $this->getVarInt(); $this->case2 = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBlockPosition($this->x, $this->y, $this->z); $this->putVarInt($this->case1); $this->putVarInt($this->case2); diff --git a/src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php b/src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php index 96e4f31c7..e748e6437 100644 --- a/src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php +++ b/src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php @@ -37,13 +37,12 @@ class BlockPickRequestPacket extends DataPacket{ public $tileZ; public $hotbarSlot; - public function decode(){ + public function decodePayload(){ $this->getSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ); $this->hotbarSlot = $this->getByte(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ); $this->putByte($this->hotbarSlot); } diff --git a/src/pocketmine/network/mcpe/protocol/BossEventPacket.php b/src/pocketmine/network/mcpe/protocol/BossEventPacket.php index 276dc06a5..ae6f304a1 100644 --- a/src/pocketmine/network/mcpe/protocol/BossEventPacket.php +++ b/src/pocketmine/network/mcpe/protocol/BossEventPacket.php @@ -64,7 +64,7 @@ class BossEventPacket extends DataPacket{ /** @var int */ public $overlay; - public function decode(){ + public function decodePayload(){ $this->bossEid = $this->getEntityUniqueId(); $this->eventType = $this->getUnsignedVarInt(); switch($this->eventType){ @@ -91,8 +91,7 @@ class BossEventPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->bossEid); $this->putUnsignedVarInt($this->eventType); switch($this->eventType){ diff --git a/src/pocketmine/network/mcpe/protocol/ChangeDimensionPacket.php b/src/pocketmine/network/mcpe/protocol/ChangeDimensionPacket.php index e625581bd..37f0950b7 100644 --- a/src/pocketmine/network/mcpe/protocol/ChangeDimensionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ChangeDimensionPacket.php @@ -40,14 +40,13 @@ class ChangeDimensionPacket extends DataPacket{ public $z; public $respawn = false; - public function decode(){ + public function decodePayload(){ $this->dimension = $this->getVarInt(); $this->getVector3f($this->x, $this->y, $this->z); $this->respawn = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->dimension); $this->putVector3f($this->x, $this->y, $this->z); $this->putBool($this->respawn); diff --git a/src/pocketmine/network/mcpe/protocol/ChunkRadiusUpdatedPacket.php b/src/pocketmine/network/mcpe/protocol/ChunkRadiusUpdatedPacket.php index f68dae1d4..4e6752989 100644 --- a/src/pocketmine/network/mcpe/protocol/ChunkRadiusUpdatedPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ChunkRadiusUpdatedPacket.php @@ -33,12 +33,11 @@ class ChunkRadiusUpdatedPacket extends DataPacket{ public $radius; - public function decode(){ + public function decodePayload(){ $this->radius = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->radius); } diff --git a/src/pocketmine/network/mcpe/protocol/ClientToServerHandshakePacket.php b/src/pocketmine/network/mcpe/protocol/ClientToServerHandshakePacket.php index 94fd8aa24..08d9f0b2a 100644 --- a/src/pocketmine/network/mcpe/protocol/ClientToServerHandshakePacket.php +++ b/src/pocketmine/network/mcpe/protocol/ClientToServerHandshakePacket.php @@ -35,12 +35,11 @@ class ClientToServerHandshakePacket extends DataPacket{ return true; } - public function decode(){ + public function decodePayload(){ //No payload } - public function encode(){ - $this->reset(); + public function encodePayload(){ //No payload } diff --git a/src/pocketmine/network/mcpe/protocol/ClientboundMapItemDataPacket.php b/src/pocketmine/network/mcpe/protocol/ClientboundMapItemDataPacket.php index 217144b17..474434aad 100644 --- a/src/pocketmine/network/mcpe/protocol/ClientboundMapItemDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ClientboundMapItemDataPacket.php @@ -50,7 +50,7 @@ class ClientboundMapItemDataPacket extends DataPacket{ /** @var Color[][] */ public $colors = []; - public function decode(){ + public function decodePayload(){ $this->mapId = $this->getEntityUniqueId(); $this->type = $this->getUnsignedVarInt(); @@ -93,8 +93,7 @@ class ClientboundMapItemDataPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->mapId); $type = 0; diff --git a/src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php b/src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php index 124b4a503..b8bfcfbb1 100644 --- a/src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php +++ b/src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php @@ -49,7 +49,7 @@ class CommandBlockUpdatePacket extends DataPacket{ public $shouldTrackOutput; - public function decode(){ + public function decodePayload(){ $this->isBlock = $this->getBool(); if($this->isBlock){ @@ -69,8 +69,7 @@ class CommandBlockUpdatePacket extends DataPacket{ $this->shouldTrackOutput = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBool($this->isBlock); if($this->isBlock){ diff --git a/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php b/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php index 5192050dc..7f80464b2 100644 --- a/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php +++ b/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php @@ -39,7 +39,7 @@ class CommandStepPacket extends DataPacket{ public $inputJson; public $outputJson; - public function decode(){ + public function decodePayload(){ $this->command = $this->getString(); $this->overload = $this->getString(); $this->uvarint1 = $this->getUnsignedVarInt(); @@ -52,8 +52,7 @@ class CommandStepPacket extends DataPacket{ $this->getRemaining(); //TODO: read command origin data } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->command); $this->putString($this->overload); $this->putUnsignedVarInt($this->uvarint1); diff --git a/src/pocketmine/network/mcpe/protocol/ContainerClosePacket.php b/src/pocketmine/network/mcpe/protocol/ContainerClosePacket.php index e0eac4c72..4d3aa7f40 100644 --- a/src/pocketmine/network/mcpe/protocol/ContainerClosePacket.php +++ b/src/pocketmine/network/mcpe/protocol/ContainerClosePacket.php @@ -33,12 +33,11 @@ class ContainerClosePacket extends DataPacket{ public $windowid; - public function decode(){ + public function decodePayload(){ $this->windowid = $this->getByte(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->windowid); } diff --git a/src/pocketmine/network/mcpe/protocol/ContainerOpenPacket.php b/src/pocketmine/network/mcpe/protocol/ContainerOpenPacket.php index caa9417f7..28d989a10 100644 --- a/src/pocketmine/network/mcpe/protocol/ContainerOpenPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ContainerOpenPacket.php @@ -38,15 +38,14 @@ class ContainerOpenPacket extends DataPacket{ public $z; public $entityUniqueId = -1; - public function decode(){ + public function decodePayload(){ $this->windowid = $this->getByte(); $this->type = $this->getByte(); $this->getBlockPosition($this->x, $this->y, $this->z); $this->entityUniqueId = $this->getEntityUniqueId(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->windowid); $this->putByte($this->type); $this->putBlockPosition($this->x, $this->y, $this->z); diff --git a/src/pocketmine/network/mcpe/protocol/ContainerSetContentPacket.php b/src/pocketmine/network/mcpe/protocol/ContainerSetContentPacket.php index 97e6ca7f1..62723d4f3 100644 --- a/src/pocketmine/network/mcpe/protocol/ContainerSetContentPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ContainerSetContentPacket.php @@ -49,7 +49,7 @@ class ContainerSetContentPacket extends DataPacket{ return parent::clean(); } - public function decode(){ + public function decodePayload(){ $this->windowid = $this->getUnsignedVarInt(); $this->targetEid = $this->getEntityUniqueId(); $count = $this->getUnsignedVarInt(); @@ -63,8 +63,7 @@ class ContainerSetContentPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putUnsignedVarInt($this->windowid); $this->putEntityUniqueId($this->targetEid); $this->putUnsignedVarInt(count($this->slots)); diff --git a/src/pocketmine/network/mcpe/protocol/ContainerSetDataPacket.php b/src/pocketmine/network/mcpe/protocol/ContainerSetDataPacket.php index 8be563fe4..656dcedfd 100644 --- a/src/pocketmine/network/mcpe/protocol/ContainerSetDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ContainerSetDataPacket.php @@ -35,14 +35,13 @@ class ContainerSetDataPacket extends DataPacket{ public $property; public $value; - public function decode(){ + public function decodePayload(){ $this->windowid = $this->getByte(); $this->property = $this->getVarInt(); $this->value = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->windowid); $this->putVarInt($this->property); $this->putVarInt($this->value); diff --git a/src/pocketmine/network/mcpe/protocol/ContainerSetSlotPacket.php b/src/pocketmine/network/mcpe/protocol/ContainerSetSlotPacket.php index 8413337fc..105f690c7 100644 --- a/src/pocketmine/network/mcpe/protocol/ContainerSetSlotPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ContainerSetSlotPacket.php @@ -38,7 +38,7 @@ class ContainerSetSlotPacket extends DataPacket{ public $item; public $selectSlot = 0; - public function decode(){ + public function decodePayload(){ $this->windowid = $this->getByte(); $this->slot = $this->getVarInt(); $this->hotbarSlot = $this->getVarInt(); @@ -46,8 +46,7 @@ class ContainerSetSlotPacket extends DataPacket{ $this->selectSlot = $this->getByte(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->windowid); $this->putVarInt($this->slot); $this->putVarInt($this->hotbarSlot); diff --git a/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php b/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php index 673f7053e..eb8a38d71 100644 --- a/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/CraftingDataPacket.php @@ -52,7 +52,7 @@ class CraftingDataPacket extends DataPacket{ return parent::clean(); } - public function decode(){ + public function decodePayload(){ $entries = []; $recipeCount = $this->getUnsignedVarInt(); for($i = 0; $i < $recipeCount; ++$i){ @@ -182,8 +182,7 @@ class CraftingDataPacket extends DataPacket{ $this->entries[] = $recipe; } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putUnsignedVarInt(count($this->entries)); $writer = new BinaryStream(); diff --git a/src/pocketmine/network/mcpe/protocol/CraftingEventPacket.php b/src/pocketmine/network/mcpe/protocol/CraftingEventPacket.php index c216c5e81..6471d6957 100644 --- a/src/pocketmine/network/mcpe/protocol/CraftingEventPacket.php +++ b/src/pocketmine/network/mcpe/protocol/CraftingEventPacket.php @@ -47,7 +47,7 @@ class CraftingEventPacket extends DataPacket{ return parent::clean(); } - public function decode(){ + public function decodePayload(){ $this->windowId = $this->getByte(); $this->type = $this->getVarInt(); $this->id = $this->getUUID(); @@ -63,8 +63,7 @@ class CraftingEventPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->windowId); $this->putVarInt($this->type); $this->putUUID($this->id); diff --git a/src/pocketmine/network/mcpe/protocol/DataPacket.php b/src/pocketmine/network/mcpe/protocol/DataPacket.php index c1f7051d0..d251f1d7a 100644 --- a/src/pocketmine/network/mcpe/protocol/DataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/DataPacket.php @@ -55,9 +55,29 @@ abstract class DataPacket extends BinaryStream{ return false; } - abstract public function encode(); + public function decode(){ + $this->offset = 1; + $this->decodePayload(); + } - abstract public function decode(); + /** + * Note for plugin developers: If you're adding your own packets, you should perform decoding in here. + */ + public function decodePayload(){ + + } + + public function encode(){ + $this->reset(); + $this->encodePayload(); + } + + /** + * Note for plugin developers: If you're adding your own packets, you should perform encoding in here. + */ + public function encodePayload(){ + + } /** * Performs handling for this packet. Usually you'll want an appropriately named method in the NetworkSession for this. diff --git a/src/pocketmine/network/mcpe/protocol/DisconnectPacket.php b/src/pocketmine/network/mcpe/protocol/DisconnectPacket.php index bf99a3974..3915e4a42 100644 --- a/src/pocketmine/network/mcpe/protocol/DisconnectPacket.php +++ b/src/pocketmine/network/mcpe/protocol/DisconnectPacket.php @@ -38,13 +38,12 @@ class DisconnectPacket extends DataPacket{ return true; } - public function decode(){ + public function decodePayload(){ $this->hideDisconnectionScreen = $this->getBool(); $this->message = $this->getString(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBool($this->hideDisconnectionScreen); if(!$this->hideDisconnectionScreen){ $this->putString($this->message); diff --git a/src/pocketmine/network/mcpe/protocol/DropItemPacket.php b/src/pocketmine/network/mcpe/protocol/DropItemPacket.php index 62df7f639..462830139 100644 --- a/src/pocketmine/network/mcpe/protocol/DropItemPacket.php +++ b/src/pocketmine/network/mcpe/protocol/DropItemPacket.php @@ -36,13 +36,12 @@ class DropItemPacket extends DataPacket{ /** @var Item */ public $item; - public function decode(){ + public function decodePayload(){ $this->type = $this->getByte(); $this->item = $this->getSlot(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->type); $this->putSlot($this->item); } diff --git a/src/pocketmine/network/mcpe/protocol/EntityEventPacket.php b/src/pocketmine/network/mcpe/protocol/EntityEventPacket.php index 12cd06d2b..cc031fef5 100644 --- a/src/pocketmine/network/mcpe/protocol/EntityEventPacket.php +++ b/src/pocketmine/network/mcpe/protocol/EntityEventPacket.php @@ -54,14 +54,13 @@ class EntityEventPacket extends DataPacket{ public $event; public $data = 0; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->event = $this->getByte(); $this->data = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putByte($this->event); $this->putVarInt($this->data); diff --git a/src/pocketmine/network/mcpe/protocol/EntityFallPacket.php b/src/pocketmine/network/mcpe/protocol/EntityFallPacket.php index 3f81b1bdb..e51ddfcfe 100644 --- a/src/pocketmine/network/mcpe/protocol/EntityFallPacket.php +++ b/src/pocketmine/network/mcpe/protocol/EntityFallPacket.php @@ -35,14 +35,13 @@ class EntityFallPacket extends DataPacket{ public $fallDistance; public $bool1; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->fallDistance = $this->getLFloat(); $this->bool1 = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putLFloat($this->fallDistance); $this->putBool($this->bool1); diff --git a/src/pocketmine/network/mcpe/protocol/ExplodePacket.php b/src/pocketmine/network/mcpe/protocol/ExplodePacket.php index 16b6e9b6f..df7d86cb2 100644 --- a/src/pocketmine/network/mcpe/protocol/ExplodePacket.php +++ b/src/pocketmine/network/mcpe/protocol/ExplodePacket.php @@ -45,7 +45,7 @@ class ExplodePacket extends DataPacket{ return parent::clean(); } - public function decode(){ + public function decodePayload(){ $this->getVector3f($this->x, $this->y, $this->z); $this->radius = (float) ($this->getVarInt() / 32); $count = $this->getUnsignedVarInt(); @@ -56,8 +56,7 @@ class ExplodePacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVector3f($this->x, $this->y, $this->z); $this->putVarInt((int) ($this->radius * 32)); $this->putUnsignedVarInt(count($this->records)); diff --git a/src/pocketmine/network/mcpe/protocol/FullChunkDataPacket.php b/src/pocketmine/network/mcpe/protocol/FullChunkDataPacket.php index cbf94323e..0d99749f6 100644 --- a/src/pocketmine/network/mcpe/protocol/FullChunkDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/FullChunkDataPacket.php @@ -35,14 +35,13 @@ class FullChunkDataPacket extends DataPacket{ public $chunkZ; public $data; - public function decode(){ + public function decodePayload(){ $this->chunkX = $this->getVarInt(); $this->chunkZ = $this->getVarInt(); $this->data = $this->getString(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->chunkX); $this->putVarInt($this->chunkZ); $this->putString($this->data); diff --git a/src/pocketmine/network/mcpe/protocol/GameRulesChangedPacket.php b/src/pocketmine/network/mcpe/protocol/GameRulesChangedPacket.php index cb740461a..6b127e2bf 100644 --- a/src/pocketmine/network/mcpe/protocol/GameRulesChangedPacket.php +++ b/src/pocketmine/network/mcpe/protocol/GameRulesChangedPacket.php @@ -32,12 +32,11 @@ class GameRulesChangedPacket extends DataPacket{ public $gameRules = []; - public function decode(){ + public function decodePayload(){ $this->gameRules = $this->getGameRules(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putGameRules($this->gameRules); } diff --git a/src/pocketmine/network/mcpe/protocol/HurtArmorPacket.php b/src/pocketmine/network/mcpe/protocol/HurtArmorPacket.php index e827b96e9..c27609d64 100644 --- a/src/pocketmine/network/mcpe/protocol/HurtArmorPacket.php +++ b/src/pocketmine/network/mcpe/protocol/HurtArmorPacket.php @@ -33,12 +33,11 @@ class HurtArmorPacket extends DataPacket{ public $health; - public function decode(){ + public function decodePayload(){ $this->health = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->health); } diff --git a/src/pocketmine/network/mcpe/protocol/InteractPacket.php b/src/pocketmine/network/mcpe/protocol/InteractPacket.php index 6caecc326..357cd8518 100644 --- a/src/pocketmine/network/mcpe/protocol/InteractPacket.php +++ b/src/pocketmine/network/mcpe/protocol/InteractPacket.php @@ -41,13 +41,12 @@ class InteractPacket extends DataPacket{ public $action; public $target; - public function decode(){ + public function decodePayload(){ $this->action = $this->getByte(); $this->target = $this->getEntityRuntimeId(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->action); $this->putEntityRuntimeId($this->target); } diff --git a/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php b/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php index 3c7f1ec77..562b6fbbe 100644 --- a/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php @@ -38,15 +38,14 @@ class InventoryActionPacket extends DataPacket{ public $enchantmentId = 0; public $enchantmentLevel = 0; - public function decode(){ + public function decodePayload(){ $this->actionId = $this->getUnsignedVarInt(); $this->item = $this->getSlot(); $this->enchantmentId = $this->getVarInt(); $this->enchantmentLevel = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putUnsignedVarInt($this->actionId); $this->putSlot($this->item); $this->putVarInt($this->enchantmentId); diff --git a/src/pocketmine/network/mcpe/protocol/ItemFrameDropItemPacket.php b/src/pocketmine/network/mcpe/protocol/ItemFrameDropItemPacket.php index 8a40e6f2c..27fb6c806 100644 --- a/src/pocketmine/network/mcpe/protocol/ItemFrameDropItemPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ItemFrameDropItemPacket.php @@ -35,12 +35,11 @@ class ItemFrameDropItemPacket extends DataPacket{ public $y; public $z; - public function decode(){ + public function decodePayload(){ $this->getBlockPosition($this->x, $this->y, $this->z); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBlockPosition($this->x, $this->y, $this->z); } diff --git a/src/pocketmine/network/mcpe/protocol/LevelEventPacket.php b/src/pocketmine/network/mcpe/protocol/LevelEventPacket.php index e7ff1ef44..4ae6da57e 100644 --- a/src/pocketmine/network/mcpe/protocol/LevelEventPacket.php +++ b/src/pocketmine/network/mcpe/protocol/LevelEventPacket.php @@ -106,14 +106,13 @@ class LevelEventPacket extends DataPacket{ public $z = 0; public $data; - public function decode(){ + public function decodePayload(){ $this->evid = $this->getVarInt(); $this->getVector3f($this->x, $this->y, $this->z); $this->data = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->evid); $this->putVector3f($this->x, $this->y, $this->z); $this->putVarInt($this->data); diff --git a/src/pocketmine/network/mcpe/protocol/LevelSoundEventPacket.php b/src/pocketmine/network/mcpe/protocol/LevelSoundEventPacket.php index 6d068d26f..190a1fe25 100644 --- a/src/pocketmine/network/mcpe/protocol/LevelSoundEventPacket.php +++ b/src/pocketmine/network/mcpe/protocol/LevelSoundEventPacket.php @@ -148,7 +148,7 @@ class LevelSoundEventPacket extends DataPacket{ public $unknownBool = false; public $disableRelativeVolume = false; - public function decode(){ + public function decodePayload(){ $this->sound = $this->getByte(); $this->getVector3f($this->x, $this->y, $this->z); $this->extraData = $this->getVarInt(); @@ -157,8 +157,7 @@ class LevelSoundEventPacket extends DataPacket{ $this->disableRelativeVolume = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->sound); $this->putVector3f($this->x, $this->y, $this->z); $this->putVarInt($this->extraData); diff --git a/src/pocketmine/network/mcpe/protocol/LoginPacket.php b/src/pocketmine/network/mcpe/protocol/LoginPacket.php index 585516b07..355a016f6 100644 --- a/src/pocketmine/network/mcpe/protocol/LoginPacket.php +++ b/src/pocketmine/network/mcpe/protocol/LoginPacket.php @@ -50,7 +50,7 @@ class LoginPacket extends DataPacket{ return true; } - public function decode(){ + public function decodePayload(){ $this->protocol = $this->getInt(); if($this->protocol !== ProtocolInfo::CURRENT_PROTOCOL){ @@ -89,7 +89,7 @@ class LoginPacket extends DataPacket{ } } - public function encode(){ + public function encodePayload(){ //TODO } diff --git a/src/pocketmine/network/mcpe/protocol/MapInfoRequestPacket.php b/src/pocketmine/network/mcpe/protocol/MapInfoRequestPacket.php index 81c869a5f..25e33f765 100644 --- a/src/pocketmine/network/mcpe/protocol/MapInfoRequestPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MapInfoRequestPacket.php @@ -34,12 +34,11 @@ class MapInfoRequestPacket extends DataPacket{ public $mapId; - public function decode(){ + public function decodePayload(){ $this->mapId = $this->getEntityUniqueId(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->mapId); } diff --git a/src/pocketmine/network/mcpe/protocol/MobArmorEquipmentPacket.php b/src/pocketmine/network/mcpe/protocol/MobArmorEquipmentPacket.php index d7e7af371..22b5b32b4 100644 --- a/src/pocketmine/network/mcpe/protocol/MobArmorEquipmentPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MobArmorEquipmentPacket.php @@ -36,7 +36,7 @@ class MobArmorEquipmentPacket extends DataPacket{ /** @var Item[] */ public $slots = []; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->slots[0] = $this->getSlot(); $this->slots[1] = $this->getSlot(); @@ -44,8 +44,7 @@ class MobArmorEquipmentPacket extends DataPacket{ $this->slots[3] = $this->getSlot(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putSlot($this->slots[0]); $this->putSlot($this->slots[1]); diff --git a/src/pocketmine/network/mcpe/protocol/MobEffectPacket.php b/src/pocketmine/network/mcpe/protocol/MobEffectPacket.php index 95efc788f..eb7ba0637 100644 --- a/src/pocketmine/network/mcpe/protocol/MobEffectPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MobEffectPacket.php @@ -42,7 +42,7 @@ class MobEffectPacket extends DataPacket{ public $particles = true; public $duration = 0; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->eventId = $this->getByte(); $this->effectId = $this->getVarInt(); @@ -51,8 +51,7 @@ class MobEffectPacket extends DataPacket{ $this->duration = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putByte($this->eventId); $this->putVarInt($this->effectId); diff --git a/src/pocketmine/network/mcpe/protocol/MobEquipmentPacket.php b/src/pocketmine/network/mcpe/protocol/MobEquipmentPacket.php index f5c48ee00..8d79800ad 100644 --- a/src/pocketmine/network/mcpe/protocol/MobEquipmentPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MobEquipmentPacket.php @@ -37,7 +37,7 @@ class MobEquipmentPacket extends DataPacket{ public $hotbarSlot; public $windowId = 0; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->item = $this->getSlot(); $this->inventorySlot = $this->getByte(); @@ -45,8 +45,7 @@ class MobEquipmentPacket extends DataPacket{ $this->windowId = $this->getByte(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putSlot($this->item); $this->putByte($this->inventorySlot); diff --git a/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php b/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php index 1ee92be15..e3db528d5 100644 --- a/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php @@ -41,7 +41,7 @@ class MoveEntityPacket extends DataPacket{ public $onGround = false; public $teleported = false; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->getVector3f($this->x, $this->y, $this->z); $this->pitch = $this->getByteRotation(); @@ -51,8 +51,7 @@ class MoveEntityPacket extends DataPacket{ $this->teleported = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putVector3f($this->x, $this->y, $this->z); $this->putByteRotation($this->pitch); diff --git a/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php b/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php index 01e354247..45bc917b5 100644 --- a/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php @@ -49,7 +49,7 @@ class MovePlayerPacket extends DataPacket{ public $int1 = 0; public $int2 = 0; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->getVector3f($this->x, $this->y, $this->z); $this->pitch = $this->getLFloat(); @@ -64,8 +64,7 @@ class MovePlayerPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putVector3f($this->x, $this->y, $this->z); $this->putLFloat($this->pitch); diff --git a/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php b/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php index 36a9e6b1b..cb6a5f61e 100644 --- a/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php @@ -39,15 +39,14 @@ class PlaySoundPacket extends DataPacket{ public $volume; public $pitch; - public function decode(){ + public function decodePayload(){ $this->soundName = $this->getString(); $this->getBlockPosition($this->x, $this->y, $this->z); $this->volume = $this->getLFloat(); $this->pitch = $this->getLFloat(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->soundName); $this->putBlockPosition($this->x, $this->y, $this->z); $this->putLFloat($this->volume); diff --git a/src/pocketmine/network/mcpe/protocol/PlayStatusPacket.php b/src/pocketmine/network/mcpe/protocol/PlayStatusPacket.php index 733efb747..29b5f624c 100644 --- a/src/pocketmine/network/mcpe/protocol/PlayStatusPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlayStatusPacket.php @@ -41,16 +41,15 @@ class PlayStatusPacket extends DataPacket{ public $status; - public function decode(){ - + public function decodePayload(){ + $this->status = $this->getInt(); } public function canBeSentBeforeLogin() : bool{ return true; } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putInt($this->status); } diff --git a/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php b/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php index 41ca09c13..a98a50f6b 100644 --- a/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php @@ -58,15 +58,14 @@ class PlayerActionPacket extends DataPacket{ public $z; public $face; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->action = $this->getVarInt(); $this->getBlockPosition($this->x, $this->y, $this->z); $this->face = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putVarInt($this->action); $this->putBlockPosition($this->x, $this->y, $this->z); diff --git a/src/pocketmine/network/mcpe/protocol/PlayerInputPacket.php b/src/pocketmine/network/mcpe/protocol/PlayerInputPacket.php index 853f34d8f..ba7c280d0 100644 --- a/src/pocketmine/network/mcpe/protocol/PlayerInputPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlayerInputPacket.php @@ -36,15 +36,14 @@ class PlayerInputPacket extends DataPacket{ public $unknownBool1; public $unknownBool2; - public function decode(){ + public function decodePayload(){ $this->motionX = $this->getLFloat(); $this->motionY = $this->getLFloat(); $this->unknownBool1 = $this->getBool(); $this->unknownBool2 = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putLFloat($this->motionX); $this->putLFloat($this->motionY); $this->putBool($this->unknownBool1); diff --git a/src/pocketmine/network/mcpe/protocol/PlayerListPacket.php b/src/pocketmine/network/mcpe/protocol/PlayerListPacket.php index 6de9d9607..1c46ef083 100644 --- a/src/pocketmine/network/mcpe/protocol/PlayerListPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlayerListPacket.php @@ -44,7 +44,7 @@ class PlayerListPacket extends DataPacket{ return parent::clean(); } - public function decode(){ + public function decodePayload(){ $this->type = $this->getByte(); $count = $this->getUnsignedVarInt(); for($i = 0; $i < $count; ++$i){ @@ -60,8 +60,7 @@ class PlayerListPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->type); $this->putUnsignedVarInt(count($this->entries)); foreach($this->entries as $d){ diff --git a/src/pocketmine/network/mcpe/protocol/RemoveBlockPacket.php b/src/pocketmine/network/mcpe/protocol/RemoveBlockPacket.php index 732be1c49..1c9e10c98 100644 --- a/src/pocketmine/network/mcpe/protocol/RemoveBlockPacket.php +++ b/src/pocketmine/network/mcpe/protocol/RemoveBlockPacket.php @@ -35,12 +35,11 @@ class RemoveBlockPacket extends DataPacket{ public $y; public $z; - public function decode(){ + public function decodePayload(){ $this->getBlockPosition($this->x, $this->y, $this->z); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBlockPosition($this->x, $this->y, $this->z); } diff --git a/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php b/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php index e8fc92398..d0093f9fa 100644 --- a/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/RemoveEntityPacket.php @@ -33,12 +33,11 @@ class RemoveEntityPacket extends DataPacket{ public $entityUniqueId; - public function decode(){ + public function decodePayload(){ $this->entityUniqueId = $this->getEntityUniqueId(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->entityUniqueId); } diff --git a/src/pocketmine/network/mcpe/protocol/ReplaceItemInSlotPacket.php b/src/pocketmine/network/mcpe/protocol/ReplaceItemInSlotPacket.php index 01b021323..c255f8532 100644 --- a/src/pocketmine/network/mcpe/protocol/ReplaceItemInSlotPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ReplaceItemInSlotPacket.php @@ -33,12 +33,11 @@ class ReplaceItemInSlotPacket extends DataPacket{ public $item; - public function decode(){ + public function decodePayload(){ $this->item = $this->getSlot(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putSlot($this->item); } diff --git a/src/pocketmine/network/mcpe/protocol/RequestChunkRadiusPacket.php b/src/pocketmine/network/mcpe/protocol/RequestChunkRadiusPacket.php index 03446659a..d50e4ba00 100644 --- a/src/pocketmine/network/mcpe/protocol/RequestChunkRadiusPacket.php +++ b/src/pocketmine/network/mcpe/protocol/RequestChunkRadiusPacket.php @@ -33,12 +33,11 @@ class RequestChunkRadiusPacket extends DataPacket{ public $radius; - public function decode(){ + public function decodePayload(){ $this->radius = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->radius); } diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePackChunkDataPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePackChunkDataPacket.php index a489e5872..29c8d1b5e 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePackChunkDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePackChunkDataPacket.php @@ -37,15 +37,14 @@ class ResourcePackChunkDataPacket extends DataPacket{ public $progress; public $data; - public function decode(){ + public function decodePayload(){ $this->packId = $this->getString(); $this->chunkIndex = $this->getLInt(); $this->progress = $this->getLLong(); $this->data = $this->get($this->getLInt()); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->packId); $this->putLInt($this->chunkIndex); $this->putLLong($this->progress); diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePackChunkRequestPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePackChunkRequestPacket.php index 100de455b..503e5ee55 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePackChunkRequestPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePackChunkRequestPacket.php @@ -35,13 +35,12 @@ class ResourcePackChunkRequestPacket extends DataPacket{ public $packId; public $chunkIndex; - public function decode(){ + public function decodePayload(){ $this->packId = $this->getString(); $this->chunkIndex = $this->getLInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->packId); $this->putLInt($this->chunkIndex); } diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePackClientResponsePacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePackClientResponsePacket.php index c19cb6ef8..6e4489ce4 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePackClientResponsePacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePackClientResponsePacket.php @@ -39,7 +39,7 @@ class ResourcePackClientResponsePacket extends DataPacket{ public $status; public $packIds = []; - public function decode(){ + public function decodePayload(){ $this->status = $this->getByte(); $entryCount = $this->getLShort(); while($entryCount-- > 0){ @@ -47,8 +47,7 @@ class ResourcePackClientResponsePacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->status); $this->putLShort(count($this->packIds)); foreach($this->packIds as $id){ diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePackDataInfoPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePackDataInfoPacket.php index 63ba1a3d4..ab133b5e6 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePackDataInfoPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePackDataInfoPacket.php @@ -38,7 +38,7 @@ class ResourcePackDataInfoPacket extends DataPacket{ public $compressedPackSize; public $sha256; - public function decode(){ + public function decodePayload(){ $this->packId = $this->getString(); $this->maxChunkSize = $this->getLInt(); $this->chunkCount = $this->getLInt(); @@ -46,8 +46,7 @@ class ResourcePackDataInfoPacket extends DataPacket{ $this->sha256 = $this->getString(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->packId); $this->putLInt($this->maxChunkSize); $this->putLInt($this->chunkCount); diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php index 619cde61a..9860c9343 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePackStackPacket.php @@ -41,7 +41,7 @@ class ResourcePackStackPacket extends DataPacket{ /** @var ResourcePack[] */ public $resourcePackStack = []; - public function decode(){ + public function decodePayload(){ /*$this->mustAccept = $this->getBool(); $behaviorPackCount = $this->getUnsignedVarInt(); while($behaviorPackCount-- > 0){ @@ -58,8 +58,7 @@ class ResourcePackStackPacket extends DataPacket{ }*/ } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBool($this->mustAccept); $this->putUnsignedVarInt(count($this->behaviorPackStack)); diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php index 56188f0d9..e79d15b9f 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php @@ -39,7 +39,7 @@ class ResourcePacksInfoPacket extends DataPacket{ /** @var ResourcePack[] */ public $resourcePackEntries = []; - public function decode(){ + public function decodePayload(){ /*$this->mustAccept = $this->getBool(); $behaviorPackCount = $this->getLShort(); while($behaviorPackCount-- > 0){ @@ -60,8 +60,7 @@ class ResourcePacksInfoPacket extends DataPacket{ }*/ } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBool($this->mustAccept); $this->putLShort(count($this->behaviorPackEntries)); diff --git a/src/pocketmine/network/mcpe/protocol/RespawnPacket.php b/src/pocketmine/network/mcpe/protocol/RespawnPacket.php index 57f1d1dfa..9f623313d 100644 --- a/src/pocketmine/network/mcpe/protocol/RespawnPacket.php +++ b/src/pocketmine/network/mcpe/protocol/RespawnPacket.php @@ -35,12 +35,11 @@ class RespawnPacket extends DataPacket{ public $y; public $z; - public function decode(){ + public function decodePayload(){ $this->getVector3f($this->x, $this->y, $this->z); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVector3f($this->x, $this->y, $this->z); } diff --git a/src/pocketmine/network/mcpe/protocol/RiderJumpPacket.php b/src/pocketmine/network/mcpe/protocol/RiderJumpPacket.php index bae4f4139..5f9f3e54a 100644 --- a/src/pocketmine/network/mcpe/protocol/RiderJumpPacket.php +++ b/src/pocketmine/network/mcpe/protocol/RiderJumpPacket.php @@ -34,12 +34,11 @@ class RiderJumpPacket extends DataPacket{ public $unknown; - public function decode(){ + public function decodePayload(){ $this->unknown = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->unknown); } diff --git a/src/pocketmine/network/mcpe/protocol/ServerToClientHandshakePacket.php b/src/pocketmine/network/mcpe/protocol/ServerToClientHandshakePacket.php index 55db716a7..e1d7b6bef 100644 --- a/src/pocketmine/network/mcpe/protocol/ServerToClientHandshakePacket.php +++ b/src/pocketmine/network/mcpe/protocol/ServerToClientHandshakePacket.php @@ -38,13 +38,12 @@ class ServerToClientHandshakePacket extends DataPacket{ return true; } - public function decode(){ + public function decodePayload(){ $this->publicKey = $this->getString(); $this->serverToken = $this->getString(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->publicKey); $this->putString($this->serverToken); } diff --git a/src/pocketmine/network/mcpe/protocol/SetCommandsEnabledPacket.php b/src/pocketmine/network/mcpe/protocol/SetCommandsEnabledPacket.php index 5c7c253d8..3922bd503 100644 --- a/src/pocketmine/network/mcpe/protocol/SetCommandsEnabledPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetCommandsEnabledPacket.php @@ -33,12 +33,11 @@ class SetCommandsEnabledPacket extends DataPacket{ public $enabled; - public function decode(){ + public function decodePayload(){ $this->enabled = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBool($this->enabled); } diff --git a/src/pocketmine/network/mcpe/protocol/SetDifficultyPacket.php b/src/pocketmine/network/mcpe/protocol/SetDifficultyPacket.php index 4abef492b..3ce9485fe 100644 --- a/src/pocketmine/network/mcpe/protocol/SetDifficultyPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetDifficultyPacket.php @@ -33,12 +33,11 @@ class SetDifficultyPacket extends DataPacket{ public $difficulty; - public function decode(){ + public function decodePayload(){ $this->difficulty = $this->getUnsignedVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putUnsignedVarInt($this->difficulty); } diff --git a/src/pocketmine/network/mcpe/protocol/SetEntityDataPacket.php b/src/pocketmine/network/mcpe/protocol/SetEntityDataPacket.php index 20f7a9c4a..98aca9f51 100644 --- a/src/pocketmine/network/mcpe/protocol/SetEntityDataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetEntityDataPacket.php @@ -34,13 +34,12 @@ class SetEntityDataPacket extends DataPacket{ public $entityRuntimeId; public $metadata; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->metadata = $this->getEntityMetadata(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putEntityMetadata($this->metadata); } diff --git a/src/pocketmine/network/mcpe/protocol/SetEntityLinkPacket.php b/src/pocketmine/network/mcpe/protocol/SetEntityLinkPacket.php index 9c5a56640..0a846cbe4 100644 --- a/src/pocketmine/network/mcpe/protocol/SetEntityLinkPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetEntityLinkPacket.php @@ -35,14 +35,13 @@ class SetEntityLinkPacket extends DataPacket{ public $to; public $type; - public function decode(){ + public function decodePayload(){ $this->from = $this->getEntityUniqueId(); $this->to = $this->getEntityUniqueId(); $this->type = $this->getByte(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->from); $this->putEntityUniqueId($this->to); $this->putByte($this->type); diff --git a/src/pocketmine/network/mcpe/protocol/SetEntityMotionPacket.php b/src/pocketmine/network/mcpe/protocol/SetEntityMotionPacket.php index 159f6bb8d..e4858549c 100644 --- a/src/pocketmine/network/mcpe/protocol/SetEntityMotionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetEntityMotionPacket.php @@ -36,13 +36,12 @@ class SetEntityMotionPacket extends DataPacket{ public $motionY; public $motionZ; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->getVector3f($this->motionX, $this->motionY, $this->motionZ); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putVector3f($this->motionX, $this->motionY, $this->motionZ); } diff --git a/src/pocketmine/network/mcpe/protocol/SetHealthPacket.php b/src/pocketmine/network/mcpe/protocol/SetHealthPacket.php index 30b5a2f58..9c6776c8b 100644 --- a/src/pocketmine/network/mcpe/protocol/SetHealthPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetHealthPacket.php @@ -33,12 +33,11 @@ class SetHealthPacket extends DataPacket{ public $health; - public function decode(){ + public function decodePayload(){ $this->health = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->health); } diff --git a/src/pocketmine/network/mcpe/protocol/SetPlayerGameTypePacket.php b/src/pocketmine/network/mcpe/protocol/SetPlayerGameTypePacket.php index 60da94dd9..deebe656d 100644 --- a/src/pocketmine/network/mcpe/protocol/SetPlayerGameTypePacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetPlayerGameTypePacket.php @@ -33,12 +33,11 @@ class SetPlayerGameTypePacket extends DataPacket{ public $gamemode; - public function decode(){ + public function decodePayload(){ $this->gamemode = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->gamemode); } diff --git a/src/pocketmine/network/mcpe/protocol/SetSpawnPositionPacket.php b/src/pocketmine/network/mcpe/protocol/SetSpawnPositionPacket.php index d28ae2699..35f46315c 100644 --- a/src/pocketmine/network/mcpe/protocol/SetSpawnPositionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetSpawnPositionPacket.php @@ -40,14 +40,13 @@ class SetSpawnPositionPacket extends DataPacket{ public $z; public $spawnForced; - public function decode(){ + public function decodePayload(){ $this->spawnType = $this->getVarInt(); $this->getBlockPosition($this->x, $this->y, $this->z); $this->spawnForced = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->spawnType); $this->putBlockPosition($this->x, $this->y, $this->z); $this->putBool($this->spawnForced); diff --git a/src/pocketmine/network/mcpe/protocol/SetTimePacket.php b/src/pocketmine/network/mcpe/protocol/SetTimePacket.php index ffb02b078..499eecc8e 100644 --- a/src/pocketmine/network/mcpe/protocol/SetTimePacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetTimePacket.php @@ -32,12 +32,11 @@ class SetTimePacket extends DataPacket{ public $time; - public function decode(){ + public function decodePayload(){ $this->time = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->time); } diff --git a/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php b/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php index 9fca39d9a..c97717cd1 100644 --- a/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php @@ -45,7 +45,7 @@ class SetTitlePacket extends DataPacket{ public $stayTime = 0; public $fadeOutTime = 0; - public function decode(){ + public function decodePayload(){ $this->type = $this->getVarInt(); $this->text = $this->getString(); $this->fadeInTime = $this->getVarInt(); @@ -53,8 +53,7 @@ class SetTitlePacket extends DataPacket{ $this->fadeOutTime = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVarInt($this->type); $this->putString($this->text); $this->putVarInt($this->fadeInTime); diff --git a/src/pocketmine/network/mcpe/protocol/ShowCreditsPacket.php b/src/pocketmine/network/mcpe/protocol/ShowCreditsPacket.php index a89a52d8d..5300fbdeb 100644 --- a/src/pocketmine/network/mcpe/protocol/ShowCreditsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ShowCreditsPacket.php @@ -38,13 +38,12 @@ class ShowCreditsPacket extends DataPacket{ public $playerEid; public $status; - public function decode(){ + public function decodePayload(){ $this->playerEid = $this->getEntityRuntimeId(); $this->status = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->playerEid); $this->putVarInt($this->status); } diff --git a/src/pocketmine/network/mcpe/protocol/SpawnExperienceOrbPacket.php b/src/pocketmine/network/mcpe/protocol/SpawnExperienceOrbPacket.php index 441f6cf90..7907df0da 100644 --- a/src/pocketmine/network/mcpe/protocol/SpawnExperienceOrbPacket.php +++ b/src/pocketmine/network/mcpe/protocol/SpawnExperienceOrbPacket.php @@ -36,13 +36,12 @@ class SpawnExperienceOrbPacket extends DataPacket{ public $z; public $amount; - public function decode(){ + public function decodePayload(){ $this->getVector3f($this->x, $this->y, $this->z); $this->amount = $this->getVarInt(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putVector3f($this->x, $this->y, $this->z); $this->putVarInt($this->amount); } diff --git a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php index b2abc89b7..6cbf1a9d0 100644 --- a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php +++ b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php @@ -61,7 +61,7 @@ class StartGamePacket extends DataPacket{ public $unknownBool = false; public $currentTick = 0; - public function decode(){ + public function decodePayload(){ $this->entityUniqueId = $this->getEntityUniqueId(); $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->playerGamemode = $this->getVarInt(); @@ -90,8 +90,7 @@ class StartGamePacket extends DataPacket{ } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityUniqueId($this->entityUniqueId); $this->putEntityRuntimeId($this->entityRuntimeId); $this->putVarInt($this->playerGamemode); diff --git a/src/pocketmine/network/mcpe/protocol/StopSoundPacket.php b/src/pocketmine/network/mcpe/protocol/StopSoundPacket.php index 13e18d093..c43326aee 100644 --- a/src/pocketmine/network/mcpe/protocol/StopSoundPacket.php +++ b/src/pocketmine/network/mcpe/protocol/StopSoundPacket.php @@ -35,13 +35,12 @@ class StopSoundPacket extends DataPacket{ public $soundName; public $stopAll; - public function decode(){ + public function decodePayload(){ $this->soundName = $this->getString(); $this->stopAll = $this->getBool(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->soundName); $this->putBool($this->stopAll); } diff --git a/src/pocketmine/network/mcpe/protocol/TakeItemEntityPacket.php b/src/pocketmine/network/mcpe/protocol/TakeItemEntityPacket.php index b799682c3..95990e371 100644 --- a/src/pocketmine/network/mcpe/protocol/TakeItemEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/TakeItemEntityPacket.php @@ -34,12 +34,11 @@ class TakeItemEntityPacket extends DataPacket{ public $target; public $eid; - public function decode(){ + public function decodePayload(){ } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->target); $this->putEntityRuntimeId($this->eid); } diff --git a/src/pocketmine/network/mcpe/protocol/TextPacket.php b/src/pocketmine/network/mcpe/protocol/TextPacket.php index aae7ab670..7e751853c 100644 --- a/src/pocketmine/network/mcpe/protocol/TextPacket.php +++ b/src/pocketmine/network/mcpe/protocol/TextPacket.php @@ -45,7 +45,7 @@ class TextPacket extends DataPacket{ public $message; public $parameters = []; - public function decode(){ + public function decodePayload(){ $this->type = $this->getByte(); switch($this->type){ case self::TYPE_POPUP: @@ -69,8 +69,7 @@ class TextPacket extends DataPacket{ } } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->type); switch($this->type){ case self::TYPE_POPUP: diff --git a/src/pocketmine/network/mcpe/protocol/TransferPacket.php b/src/pocketmine/network/mcpe/protocol/TransferPacket.php index 91c9d6edf..41881c591 100644 --- a/src/pocketmine/network/mcpe/protocol/TransferPacket.php +++ b/src/pocketmine/network/mcpe/protocol/TransferPacket.php @@ -33,13 +33,12 @@ class TransferPacket extends DataPacket{ public $address; public $port = 19132; - public function decode(){ + public function decodePayload(){ $this->address = $this->getString(); $this->port = $this->getLShort(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putString($this->address); $this->putLShort($this->port); } diff --git a/src/pocketmine/network/mcpe/protocol/UnknownPacket.php b/src/pocketmine/network/mcpe/protocol/UnknownPacket.php index d11517c80..cd4844a26 100644 --- a/src/pocketmine/network/mcpe/protocol/UnknownPacket.php +++ b/src/pocketmine/network/mcpe/protocol/UnknownPacket.php @@ -44,7 +44,6 @@ class UnknownPacket extends DataPacket{ } public function decode(){ - $this->offset -= 1; //Rewind one byte so we can read the PID $this->payload = $this->getRemaining(); } diff --git a/src/pocketmine/network/mcpe/protocol/UpdateAttributesPacket.php b/src/pocketmine/network/mcpe/protocol/UpdateAttributesPacket.php index 5c6a283a2..8d86708c6 100644 --- a/src/pocketmine/network/mcpe/protocol/UpdateAttributesPacket.php +++ b/src/pocketmine/network/mcpe/protocol/UpdateAttributesPacket.php @@ -36,13 +36,12 @@ class UpdateAttributesPacket extends DataPacket{ /** @var Attribute[] */ public $entries = []; - public function decode(){ + public function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->entries = $this->getAttributeList(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putAttributeList(...$this->entries); } diff --git a/src/pocketmine/network/mcpe/protocol/UpdateBlockPacket.php b/src/pocketmine/network/mcpe/protocol/UpdateBlockPacket.php index 0747696f2..4cf3b023c 100644 --- a/src/pocketmine/network/mcpe/protocol/UpdateBlockPacket.php +++ b/src/pocketmine/network/mcpe/protocol/UpdateBlockPacket.php @@ -47,7 +47,7 @@ class UpdateBlockPacket extends DataPacket{ public $blockData; public $flags; - public function decode(){ + public function decodePayload(){ $this->getBlockPosition($this->x, $this->y, $this->z); $this->blockId = $this->getUnsignedVarInt(); $aux = $this->getUnsignedVarInt(); @@ -55,8 +55,7 @@ class UpdateBlockPacket extends DataPacket{ $this->flags = $aux >> 4; } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putBlockPosition($this->x, $this->y, $this->z); $this->putUnsignedVarInt($this->blockId); $this->putUnsignedVarInt(($this->flags << 4) | $this->blockData); diff --git a/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php b/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php index b2d700466..9a7496f86 100644 --- a/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php +++ b/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php @@ -44,7 +44,7 @@ class UpdateTradePacket extends DataPacket{ public $displayName; public $offers; - public function decode(){ + public function decodePayload(){ $this->windowId = $this->getByte(); $this->windowType = $this->getByte(); $this->varint1 = $this->getVarInt(); @@ -56,8 +56,7 @@ class UpdateTradePacket extends DataPacket{ $this->offers = $this->getRemaining(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putByte($this->windowId); $this->putByte($this->windowType); $this->putVarInt($this->varint1); diff --git a/src/pocketmine/network/mcpe/protocol/UseItemPacket.php b/src/pocketmine/network/mcpe/protocol/UseItemPacket.php index 0f1929897..2f8ff56fe 100644 --- a/src/pocketmine/network/mcpe/protocol/UseItemPacket.php +++ b/src/pocketmine/network/mcpe/protocol/UseItemPacket.php @@ -47,7 +47,7 @@ class UseItemPacket extends DataPacket{ /** @var Item */ public $item; - public function decode(){ + public function decodePayload(){ $this->getBlockPosition($this->x, $this->y, $this->z); $this->blockId = $this->getUnsignedVarInt(); $this->face = $this->getVarInt(); @@ -57,8 +57,7 @@ class UseItemPacket extends DataPacket{ $this->item = $this->getSlot(); } - public function encode(){ - $this->reset(); + public function encodePayload(){ $this->putUnsignedVarInt($this->blockId); $this->putUnsignedVarInt($this->face); $this->putVector3f($this->fx, $this->fy, $this->fz);