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