Cleaned up muddled varint/varlong mess, added separate methods for entity unique and runtime ids, moved some MCPE-protocol-specific methods out of BinaryStream

This commit is contained in:
Dylan K. Taylor
2017-03-08 19:34:12 +00:00
parent 3a044f0154
commit 295d9bc80b
36 changed files with 177 additions and 110 deletions

View File

@ -28,25 +28,13 @@ use pocketmine\network\mcpe\NetworkSession;
class CommandStepPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::COMMAND_STEP_PACKET;
/**
* unknown (string)
* unknown (string)
* unknown (uvarint)
* unknown (uvarint)
* unknown (bool)
* unknown (uvarint64)
* unknown (string)
* unknown (string)
* https://gist.github.com/dktapps/8285b93af4ca38e0104bfeb9a6c87afd
*/
public $command;
public $overload;
public $uvarint1;
public $uvarint2;
public $bool;
public $uvarint64;
public $args; //JSON formatted command arguments
public $args;
public $string4;
public function decode(){
@ -55,12 +43,11 @@ class CommandStepPacket extends DataPacket{
$this->uvarint1 = $this->getUnsignedVarInt();
$this->uvarint2 = $this->getUnsignedVarInt();
$this->bool = (bool) $this->getByte();
$this->uvarint64 = $this->getUnsignedVarInt(); //TODO: varint64
$this->uvarint64 = $this->getUnsignedVarLong();
$this->args = json_decode($this->getString());
$this->string4 = $this->getString();
while(!$this->feof()){
$this->getByte(); //prevent assertion errors. TODO: find out why there are always 3 extra bytes at the end of this packet.
}
$this->get(true); //TODO: read command origin data
}
public function encode(){