mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
populate missing array value types in network namespace
This commit is contained in:
parent
a5764b3ae9
commit
fc0619ee6e
@ -272,6 +272,8 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
* Decodes entity metadata from the stream.
|
||||
*
|
||||
* @param bool $types Whether to include metadata types along with values in the returned array
|
||||
*
|
||||
* @return mixed[]|mixed[][]
|
||||
*/
|
||||
public function getEntityMetadata(bool $types = true) : array{
|
||||
$count = $this->getUnsignedVarInt();
|
||||
@ -324,6 +326,8 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
|
||||
/**
|
||||
* Writes entity metadata to the packet buffer.
|
||||
*
|
||||
* @param mixed[][] $metadata
|
||||
*/
|
||||
public function putEntityMetadata(array $metadata) : void{
|
||||
$this->putUnsignedVarInt(count($metadata));
|
||||
@ -540,7 +544,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
* Reads gamerules
|
||||
* TODO: implement this properly
|
||||
*
|
||||
* @return array, members are in the structure [name => [type, value]]
|
||||
* @return mixed[][], members are in the structure [name => [type, value]]
|
||||
*/
|
||||
public function getGameRules() : array{
|
||||
$count = $this->getUnsignedVarInt();
|
||||
@ -570,6 +574,8 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
/**
|
||||
* Writes a gamerule array, members should be in the structure [name => [type, value]]
|
||||
* TODO: implement this properly
|
||||
*
|
||||
* @param mixed[][] $rules
|
||||
*/
|
||||
public function putGameRules(array $rules) : void{
|
||||
$this->putUnsignedVarInt(count($rules));
|
||||
|
@ -163,7 +163,7 @@ class AddActorPacket extends DataPacket{
|
||||
|
||||
/** @var Attribute[] */
|
||||
public $attributes = [];
|
||||
/** @var array */
|
||||
/** @var mixed[][] */
|
||||
public $metadata = [];
|
||||
/** @var EntityLink[] */
|
||||
public $links = [];
|
||||
|
@ -42,7 +42,7 @@ class AddItemActorPacket extends DataPacket{
|
||||
public $position;
|
||||
/** @var Vector3|null */
|
||||
public $motion;
|
||||
/** @var array */
|
||||
/** @var mixed[][] */
|
||||
public $metadata = [];
|
||||
/** @var bool */
|
||||
public $isFromFishing = false;
|
||||
|
@ -57,7 +57,7 @@ class AddPlayerPacket extends DataPacket{
|
||||
public $headYaw = null; //TODO
|
||||
/** @var Item */
|
||||
public $item;
|
||||
/** @var array */
|
||||
/** @var mixed[][] */
|
||||
public $metadata = [];
|
||||
|
||||
//TODO: adventure settings stuff
|
||||
|
@ -360,6 +360,9 @@ class AvailableCommandsPacket extends DataPacket{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $postfixes
|
||||
*/
|
||||
private function argTypeToString(int $argtype, array $postfixes) : string{
|
||||
if($argtype & self::ARG_FLAG_VALID){
|
||||
if($argtype & self::ARG_FLAG_ENUM){
|
||||
|
@ -30,7 +30,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class GameRulesChangedPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::GAME_RULES_CHANGED_PACKET;
|
||||
|
||||
/** @var array */
|
||||
/** @var mixed[][] */
|
||||
public $gameRules = [];
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -56,6 +56,9 @@ class LevelChunkPacket extends DataPacket/* implements ClientboundPacket*/{
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $usedBlobHashes
|
||||
*/
|
||||
public static function withCache(int $chunkX, int $chunkZ, int $subChunkCount, array $usedBlobHashes, string $extraPayload) : self{
|
||||
(static function(int ...$hashes){})(...$usedBlobHashes);
|
||||
$result = new self;
|
||||
|
@ -54,11 +54,11 @@ class LoginPacket extends DataPacket{
|
||||
/** @var string */
|
||||
public $locale;
|
||||
|
||||
/** @var array (the "chain" index contains one or more JWTs) */
|
||||
/** @var string[][] (the "chain" index contains one or more JWTs) */
|
||||
public $chainData = [];
|
||||
/** @var string */
|
||||
public $clientDataJwt;
|
||||
/** @var array decoded payload of the clientData JWT */
|
||||
/** @var mixed[] decoded payload of the clientData JWT */
|
||||
public $clientData = [];
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ class SetActorDataPacket extends DataPacket{
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var array */
|
||||
/** @var mixed[][] */
|
||||
public $metadata;
|
||||
|
||||
protected function decodePayload(){
|
||||
|
@ -102,7 +102,7 @@ class StartGamePacket extends DataPacket{
|
||||
public $commandsEnabled;
|
||||
/** @var bool */
|
||||
public $isTexturePacksRequired = true;
|
||||
/** @var array */
|
||||
/** @var mixed[][] */
|
||||
public $gameRules = [ //TODO: implement this
|
||||
"naturalregeneration" => [1, false] //Hack for client side regeneration
|
||||
];
|
||||
@ -152,7 +152,7 @@ class StartGamePacket extends DataPacket{
|
||||
|
||||
/** @var ListTag|null */
|
||||
public $blockTable = null;
|
||||
/** @var array|null string (name) => int16 (legacyID) */
|
||||
/** @var int[]|null string (name) => int16 (legacyID) */
|
||||
public $itemTable = null;
|
||||
|
||||
protected function decodePayload(){
|
||||
@ -299,6 +299,9 @@ class StartGamePacket extends DataPacket{
|
||||
$this->putString($this->multiplayerCorrelationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $table
|
||||
*/
|
||||
private static function serializeItemTable(array $table) : string{
|
||||
$stream = new NetworkBinaryStream();
|
||||
$stream->putUnsignedVarInt(count($table));
|
||||
|
Loading…
x
Reference in New Issue
Block a user