13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
23 public const NETWORK_ID = ProtocolInfo::RESOURCE_PACKS_INFO_PACKET;
26 public array $resourcePackEntries = [];
28 public array $behaviorPackEntries = [];
29 public bool $mustAccept =
false;
30 public bool $hasAddons =
false;
31 public bool $hasScripts =
false;
32 public bool $forceServerPacks =
false;
37 public array $cdnUrls = [];
47 array $resourcePackEntries,
48 array $behaviorPackEntries,
52 bool $forceServerPacks,
56 $result->resourcePackEntries = $resourcePackEntries;
57 $result->behaviorPackEntries = $behaviorPackEntries;
58 $result->mustAccept = $mustAccept;
59 $result->hasAddons = $hasAddons;
60 $result->hasScripts = $hasScripts;
61 $result->forceServerPacks = $forceServerPacks;
62 $result->cdnUrls = $cdnUrls;
67 $this->mustAccept = $in->getBool();
68 $this->hasAddons = $in->
getBool();
69 $this->hasScripts = $in->
getBool();
70 $this->forceServerPacks = $in->
getBool();
72 while($behaviorPackCount-- > 0){
73 $this->behaviorPackEntries[] = BehaviorPackInfoEntry::read($in);
77 while($resourcePackCount-- > 0){
78 $this->resourcePackEntries[] = ResourcePackInfoEntry::read($in);
85 $this->cdnUrls[$packId] = $cdnUrl;
90 $out->putBool($this->mustAccept);
91 $out->putBool($this->hasAddons);
92 $out->putBool($this->hasScripts);
93 $out->putBool($this->forceServerPacks);
94 $out->putLShort(count($this->behaviorPackEntries));
95 foreach($this->behaviorPackEntries as $entry){
98 $out->putLShort(count($this->resourcePackEntries));
99 foreach($this->resourcePackEntries as $entry){
103 foreach($this->cdnUrls as $packId => $cdnUrl){
104 $out->putString($packId);
105 $out->putString($cdnUrl);
110 return $handler->handleResourcePacksInfo($this);
handle(PacketHandlerInterface $handler)
encodePayload(PacketSerializer $out)
decodePayload(PacketSerializer $in)
static create(array $resourcePackEntries, array $behaviorPackEntries, bool $mustAccept, bool $hasAddons, bool $hasScripts, bool $forceServerPacks, array $cdnUrls,)
putUnsignedVarInt(int $v)