13declare(strict_types=1);
 
   15namespace pocketmine\network\mcpe\protocol;
 
   17use pmmp\encoding\ByteBufferReader;
 
   18use pmmp\encoding\ByteBufferWriter;
 
   20use pmmp\encoding\VarInt;
 
   22use pocketmine\network\mcpe\protocol\types\hud\LoadingScreenType;
 
   25    public const NETWORK_ID = ProtocolInfo::SERVERBOUND_LOADING_SCREEN_PACKET;
 
   27    private LoadingScreenType $loadingScreenType;
 
   28    private ?
int $loadingScreenId = 
null;
 
   33    public static function create(LoadingScreenType $loadingScreenType, ?
int $loadingScreenId) : self{
 
   35        $result->loadingScreenType = $loadingScreenType;
 
   36        $result->loadingScreenId = $loadingScreenId;
 
 
   40    public function getLoadingScreenType() : LoadingScreenType{ return $this->loadingScreenType; }
 
   42    public function getLoadingScreenId() : ?int{ return $this->loadingScreenId; }
 
   45        $this->loadingScreenType = LoadingScreenType::fromPacket(VarInt::readSignedInt($in));
 
   46        $this->loadingScreenId = CommonTypes::readOptional($in, LE::readUnsignedInt(...));
 
 
   50        VarInt::writeSignedInt($out, $this->loadingScreenType->value);
 
   51        CommonTypes::writeOptional($out, $this->loadingScreenId, LE::writeUnsignedInt(...));
 
 
   55        return $handler->handleServerboundLoadingScreen($this);
 
 
 
handle(PacketHandlerInterface $handler)
 
encodePayload(ByteBufferWriter $out)
 
static create(LoadingScreenType $loadingScreenType, ?int $loadingScreenId)
 
decodePayload(ByteBufferReader $in)