Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'

# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/lang/Language.php
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/permission/Permission.php
#	src/pocketmine/block/Leaves.php
#	src/pocketmine/entity/DataPropertyManager.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
#	src/pocketmine/tile/Banner.php
#	src/scheduler/BulkCurlTask.php
#	src/updater/AutoUpdater.php
#	src/utils/Config.php
#	src/utils/Utils.php
#	src/world/generator/Flat.php
#	src/world/generator/Generator.php
This commit is contained in:
Dylan K. Taylor
2020-01-31 21:07:34 +00:00
39 changed files with 164 additions and 25 deletions

View File

@@ -165,7 +165,10 @@ class AddActorPacket extends DataPacket implements ClientboundPacket{
/** @var Attribute[] */
public $attributes = [];
/** @var MetadataProperty[] */
/**
* @var MetadataProperty[]
* @phpstan-var array<int, MetadataProperty>
*/
public $metadata = [];
/** @var EntityLink[] */
public $links = [];

View File

@@ -43,7 +43,10 @@ class AddItemActorPacket extends DataPacket implements ClientboundPacket{
public $position;
/** @var Vector3|null */
public $motion;
/** @var MetadataProperty[] */
/**
* @var MetadataProperty[]
* @phpstan-var array<int, MetadataProperty>
*/
public $metadata = [];
/** @var bool */
public $isFromFishing = false;

View File

@@ -58,7 +58,10 @@ class AddPlayerPacket extends DataPacket implements ClientboundPacket{
public $headYaw = null; //TODO
/** @var Item */
public $item;
/** @var MetadataProperty[] */
/**
* @var MetadataProperty[]
* @phpstan-var array<int, MetadataProperty>
*/
public $metadata = [];
//TODO: adventure settings stuff

View File

@@ -371,6 +371,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
/**
* @param string[] $postfixes
* @phpstan-param array<int, string> $postfixes
*/
private function argTypeToString(int $argtype, array $postfixes) : string{
if($argtype & self::ARG_FLAG_VALID){

View File

@@ -30,7 +30,10 @@ use pocketmine\network\mcpe\handler\PacketHandler;
class GameRulesChangedPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::GAME_RULES_CHANGED_PACKET;
/** @var mixed[][] */
/**
* @var mixed[][]
* @phpstan-var array<string, array{0: int, 1: bool|int|float}>
*/
public $gameRules = [];
protected function decodePayload() : void{

View File

@@ -87,7 +87,10 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
public $extraData = null;
/** @var string */
public $clientDataJwt;
/** @var mixed[] decoded payload of the clientData JWT */
/**
* @var mixed[] decoded payload of the clientData JWT
* @phpstan-var array<string, mixed>
*/
public $clientData = [];
/**

View File

@@ -33,7 +33,10 @@ class SetActorDataPacket extends DataPacket implements ClientboundPacket, Server
/** @var int */
public $entityRuntimeId;
/** @var MetadataProperty[] */
/**
* @var MetadataProperty[]
* @phpstan-var array<int, MetadataProperty>
*/
public $metadata;
public static function create(int $entityRuntimeId, array $metadata) : self{

View File

@@ -103,7 +103,10 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{
public $commandsEnabled;
/** @var bool */
public $isTexturePacksRequired = true;
/** @var mixed[][] */
/**
* @var mixed[][]
* @phpstan-var array<string, array{0: int, 1: bool|int|float}>
*/
public $gameRules = [ //TODO: implement this
"naturalregeneration" => [1, false] //Hack for client side regeneration
];
@@ -153,7 +156,10 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{
/** @var ListTag|null */
public $blockTable = null;
/** @var int[]|null string (name) => int16 (legacyID) */
/**
* @var int[]|null string (name) => int16 (legacyID)
* @phpstan-var array<string, int>|null
*/
public $itemTable = null;
protected function decodePayload() : void{
@@ -302,6 +308,7 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{
/**
* @param int[] $table
* @phpstan-param array<string, int> $table
*/
private static function serializeItemTable(array $table) : string{
$stream = new NetworkBinaryStream();

View File

@@ -29,9 +29,15 @@ use function get_class;
class EntityMetadataCollection{
/** @var MetadataProperty[] */
/**
* @var MetadataProperty[]
* @phpstan-var array<int, MetadataProperty>
*/
private $properties = [];
/** @var MetadataProperty[] */
/**
* @var MetadataProperty[]
* @phpstan-var array<int, MetadataProperty>
*/
private $dirtyProperties = [];
public function __construct(){
@@ -121,6 +127,7 @@ class EntityMetadataCollection{
* Returns all properties.
*
* @return MetadataProperty[]
* @phpstan-return array<int, MetadataProperty>
*/
public function getAll() : array{
return $this->properties;
@@ -130,6 +137,7 @@ class EntityMetadataCollection{
* Returns properties that have changed and need to be broadcasted.
*
* @return MetadataProperty[]
* @phpstan-return array<int, MetadataProperty>
*/
public function getDirty() : array{
return $this->dirtyProperties;

View File

@@ -297,6 +297,7 @@ class NetworkBinaryStream extends BinaryStream{
* Decodes entity metadata from the stream.
*
* @return MetadataProperty[]
* @phpstan-return array<int, MetadataProperty>
*
* @throws BadPacketException
* @throws BinaryDataException
@@ -334,6 +335,7 @@ class NetworkBinaryStream extends BinaryStream{
* Writes entity metadata to the packet buffer.
*
* @param MetadataProperty[] $metadata
* @phpstan-param array<int, MetadataProperty> $metadata
*/
public function putEntityMetadata(array $metadata) : void{
$this->putUnsignedVarInt(count($metadata));
@@ -530,6 +532,7 @@ class NetworkBinaryStream extends BinaryStream{
* TODO: implement this properly
*
* @return mixed[][], members are in the structure [name => [type, value]]
* @phpstan-return array<string, array{0: int, 1: bool|int|float}>
*
* @throws BadPacketException
* @throws BinaryDataException
@@ -566,6 +569,7 @@ class NetworkBinaryStream extends BinaryStream{
* TODO: implement this properly
*
* @param mixed[][] $rules
* @phpstan-param array<string, array{0: int, 1: bool|int|float}> $rules
*/
public function putGameRules(array $rules) : void{
$this->putUnsignedVarInt(count($rules));