Protocol changes for 1.16.200

This commit is contained in:
Dylan K. Taylor 2020-12-08 20:31:17 +00:00
parent 4d1be4d41d
commit 692e63ad7c
7 changed files with 84 additions and 6 deletions

View File

@ -72,6 +72,7 @@ use pocketmine\network\mcpe\protocol\EducationSettingsPacket;
use pocketmine\network\mcpe\protocol\EmoteListPacket;
use pocketmine\network\mcpe\protocol\EmotePacket;
use pocketmine\network\mcpe\protocol\EventPacket;
use pocketmine\network\mcpe\protocol\FilterTextPacket;
use pocketmine\network\mcpe\protocol\GameRulesChangedPacket;
use pocketmine\network\mcpe\protocol\GuiDataPickItemPacket;
use pocketmine\network\mcpe\protocol\HurtArmorPacket;
@ -816,4 +817,8 @@ abstract class NetworkSession{
public function handleItemComponent(ItemComponentPacket $packet) : bool{
return false;
}
public function handleFilterText(FilterTextPacket $packet) : bool{
return false;
}
}

View File

@ -0,0 +1,62 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
class FilterTextPacket extends DataPacket/* implements ClientboundPacket, ServerboundPacket*/{
public const NETWORK_ID = ProtocolInfo::FILTER_TEXT_PACKET;
/** @var string */
private $text;
/** @var bool */
private $fromServer;
public static function create(string $text, bool $server) : self{
$result = new self;
$result->text = $text;
$result->fromServer = $server;
return $result;
}
public function getText() : string{ return $this->text; }
public function isFromServer() : bool{ return $this->fromServer; }
protected function decodePayload() : void{
$this->text = $this->getString();
$this->fromServer = $this->getBool();
}
protected function encodePayload() : void{
$this->putString($this->text);
$this->putBool($this->fromServer);
}
public function handle(NetworkSession $handler) : bool{
return $handler->handleFilterText($this);
}
}

View File

@ -193,6 +193,7 @@ class PacketPool{
static::registerPacket(new PlayerFogPacket());
static::registerPacket(new CorrectPlayerMovePredictionPacket());
static::registerPacket(new ItemComponentPacket());
static::registerPacket(new FilterTextPacket());
}
/**

View File

@ -37,11 +37,11 @@ interface ProtocolInfo{
*/
/** Actual Minecraft: PE protocol version */
public const CURRENT_PROTOCOL = 419;
public const CURRENT_PROTOCOL = 422;
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
public const MINECRAFT_VERSION = 'v1.16.100';
public const MINECRAFT_VERSION = 'v1.16.200';
/** Version number sent to clients in ping responses. */
public const MINECRAFT_VERSION_NETWORK = '1.16.100';
public const MINECRAFT_VERSION_NETWORK = '1.16.200';
public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;
@ -205,5 +205,6 @@ interface ProtocolInfo{
public const PLAYER_FOG_PACKET = 0xa0;
public const CORRECT_PLAYER_MOVE_PREDICTION_PACKET = 0xa1;
public const ITEM_COMPONENT_PACKET = 0xa2;
public const FILTER_TEXT_PACKET = 0xa3;
}

View File

@ -64,6 +64,7 @@ class ResourcePacksInfoPacket extends DataPacket{
$this->getString();
$this->getString();
$this->getBool();
$this->getBool();
}
}
@ -89,6 +90,7 @@ class ResourcePacksInfoPacket extends DataPacket{
$this->putString(""); //TODO: subpack name
$this->putString(""); //TODO: content identity
$this->putBool(false); //TODO: seems useless for resource packs
$this->putBool(false); //TODO: supports RTX
}
}

View File

@ -35,12 +35,15 @@ final class ItemStackResponseSlotInfo{
private $count;
/** @var int */
private $itemStackId;
/** @var string */
private $customName;
public function __construct(int $slot, int $hotbarSlot, int $count, int $itemStackId){
public function __construct(int $slot, int $hotbarSlot, int $count, int $itemStackId, string $customName){
$this->slot = $slot;
$this->hotbarSlot = $hotbarSlot;
$this->count = $count;
$this->itemStackId = $itemStackId;
$this->customName = $customName;
}
public function getSlot() : int{ return $this->slot; }
@ -51,12 +54,15 @@ final class ItemStackResponseSlotInfo{
public function getItemStackId() : int{ return $this->itemStackId; }
public function getCustomName() : string{ return $this->customName; }
public static function read(NetworkBinaryStream $in) : self{
$slot = $in->getByte();
$hotbarSlot = $in->getByte();
$count = $in->getByte();
$itemStackId = $in->readGenericTypeNetworkId();
return new self($slot, $hotbarSlot, $count, $itemStackId);
$customName = $in->getString();
return new self($slot, $hotbarSlot, $count, $itemStackId, $customName);
}
public function write(NetworkBinaryStream $out) : void{
@ -64,5 +70,6 @@ final class ItemStackResponseSlotInfo{
$out->putByte($this->hotbarSlot);
$out->putByte($this->count);
$out->writeGenericTypeNetworkId($this->itemStackId);
$out->putString($this->customName);
}
}

@ -1 +1 @@
Subproject commit 14f4a765eba40b2c65c6dcd061cbfea6e1d3d4cc
Subproject commit 4e58a3c67dea62600ce5fd014b9fd792a50d246d