mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
DataPacket: inject buffer via parameter instead of class field (packet & stream separation, step 2)
this is not complete yet, but the final change (having the binarystream actually come from outside) is a little more disruptive, and some extra changes need to be made. This will grant some sanity in the meantime without breaking too much stuff.
This commit is contained in:
@@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
#include <rules/DataPacket.h>
|
||||
|
||||
use pocketmine\network\mcpe\handler\PacketHandler;
|
||||
use pocketmine\network\mcpe\serializer\NetworkBinaryStream;
|
||||
|
||||
class MapCreateLockedCopyPacket extends DataPacket implements ServerboundPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MAP_CREATE_LOCKED_COPY_PACKET;
|
||||
@@ -35,14 +36,14 @@ class MapCreateLockedCopyPacket extends DataPacket implements ServerboundPacket{
|
||||
/** @var int */
|
||||
public $newMapId;
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->originalMapId = $this->buf->getEntityUniqueId();
|
||||
$this->newMapId = $this->buf->getEntityUniqueId();
|
||||
protected function decodePayload(NetworkBinaryStream $in) : void{
|
||||
$this->originalMapId = $in->getEntityUniqueId();
|
||||
$this->newMapId = $in->getEntityUniqueId();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->buf->putEntityUniqueId($this->originalMapId);
|
||||
$this->buf->putEntityUniqueId($this->newMapId);
|
||||
protected function encodePayload(NetworkBinaryStream $out) : void{
|
||||
$out->putEntityUniqueId($this->originalMapId);
|
||||
$out->putEntityUniqueId($this->newMapId);
|
||||
}
|
||||
|
||||
public function handle(PacketHandler $handler) : bool{
|
||||
|
Reference in New Issue
Block a user