Protocol changes for 1.6.0.1

This commit is contained in:
Dylan K. Taylor
2018-06-15 19:24:23 +01:00
parent 6fce2b3349
commit 986077e03c
15 changed files with 266 additions and 42 deletions

View File

@ -27,12 +27,16 @@ namespace pocketmine\network\mcpe\protocol;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\NetworkBinaryStream;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
class StartGamePacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::START_GAME_PACKET;
/** @var string|null */
private static $runtimeIdTable;
/** @var int */
public $entityUniqueId;
/** @var int */
@ -175,6 +179,12 @@ class StartGamePacket extends DataPacket{
$this->currentTick = $this->getLLong();
$this->enchantmentSeed = $this->getVarInt();
$count = $this->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){
$this->getString();
$this->getLShort();
}
}
protected function encodePayload(){
@ -226,6 +236,19 @@ class StartGamePacket extends DataPacket{
$this->putLLong($this->currentTick);
$this->putVarInt($this->enchantmentSeed);
if(self::$runtimeIdTable === null){
//this is a really nasty hack, but it'll do for now
$stream = new NetworkBinaryStream();
$data = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true);
$stream->putUnsignedVarInt(count($data));
foreach($data as $v){
$stream->putString($v["name"]);
$stream->putLShort($v["data"]);
}
self::$runtimeIdTable = $stream->buffer;
}
$this->put(self::$runtimeIdTable);
}
public function handle(NetworkSession $session) : bool{