Protocol changes for 1.6.0.8 + resource packs "fix"

This commit is contained in:
Dylan K. Taylor 2018-07-27 16:42:11 +01:00
parent 424c50e1e9
commit 9ca38ba868
4 changed files with 17 additions and 4 deletions

View File

@ -2025,7 +2025,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
case ResourcePackClientResponsePacket::STATUS_SEND_PACKS:
$manager = $this->server->getResourcePackManager();
foreach($packet->packIds as $uuid){
$pack = $manager->getPackById($uuid);
$pack = $manager->getPackById(substr($uuid, 0, strpos($uuid, "_"))); //dirty hack for mojang's dirty hack for versions
if(!($pack instanceof ResourcePack)){
//Client requested a resource pack but we don't have it available on the server
$this->close("", "disconnectionScreen.resourcePack", true);

View File

@ -75,6 +75,9 @@ class AddPlayerPacket extends DataPacket{
/** @var EntityLink[] */
public $links = [];
/** @var string */
public $deviceId = ""; //TODO: fill player's device ID (???)
protected function decodePayload(){
$this->uuid = $this->getUUID();
$this->username = $this->getString();
@ -103,6 +106,8 @@ class AddPlayerPacket extends DataPacket{
for($i = 0; $i < $linkCount; ++$i){
$this->links[$i] = $this->getEntityLink();
}
$this->deviceId = $this->getString();
}
protected function encodePayload(){
@ -133,6 +138,8 @@ class AddPlayerPacket extends DataPacket{
foreach($this->links as $link){
$this->putEntityLink($link);
}
$this->putString($this->deviceId);
}
public function handle(NetworkSession $session) : bool{

View File

@ -39,15 +39,15 @@ interface ProtocolInfo{
/**
* Actual Minecraft: PE protocol version
*/
public const CURRENT_PROTOCOL = 281;
public const CURRENT_PROTOCOL = 282;
/**
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
*/
public const MINECRAFT_VERSION = 'v1.6.0.5 beta';
public const MINECRAFT_VERSION = 'v1.6.0.8 beta';
/**
* Version number sent to clients in ping responses.
*/
public const MINECRAFT_VERSION_NETWORK = '1.6.0.5';
public const MINECRAFT_VERSION_NETWORK = '1.6.0.8';
public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;

View File

@ -129,6 +129,8 @@ class StartGamePacket extends DataPacket{
public $currentTick = 0; //only used if isTrial is true
/** @var int */
public $enchantmentSeed = 0;
/** @var string */
public $multiplayerCorrelationId = ""; //TODO: this should be filled with a UUID of some sort
protected function decodePayload(){
$this->entityUniqueId = $this->getEntityUniqueId();
@ -185,6 +187,8 @@ class StartGamePacket extends DataPacket{
$this->getString();
$this->getLShort();
}
$this->multiplayerCorrelationId = $this->getString();
}
protected function encodePayload(){
@ -249,6 +253,8 @@ class StartGamePacket extends DataPacket{
self::$runtimeIdTable = $stream->buffer;
}
$this->put(self::$runtimeIdTable);
$this->putString($this->multiplayerCorrelationId);
}
public function handle(NetworkSession $session) : bool{