use pocketmine\network\PocketEditionNetworkSession; use pocketmine\resourcepacks\ResourcePackInfoEntry; class ResourcePackStackPacket extends DataPacket{ const NETWORK_ID = Info::RESOURCE_PACK_STACK_PACKET; public $mustAccept = false; /** @var ResourcePackInfoEntry[] */ public $behaviorPackStack = []; /** @var ResourcePackInfoEntry[] */ public $resourcePackStack = []; public function decode(){ $this->mustAccept = $this->getBool(); $behaviorPackCount = $this->getLShort(); while($behaviorPackCountCount-- > 0){ $packId = $this->getString(); $version = $this->getString(); $this->behaviorPackStack[] = new ResourcePackInfoEntry($packId, $version); } $resourcePackCount = $this->getLShort(); while($resourcePackCount-- > 0){ $packId = $this->getString(); $version = $this->getString(); $this->resourcePackStack[] = new ResourcePackInfoEntry($packId, $version); } } public function encode(){ $this->reset(); $this->putBool($this->mustAccept); $this->putLShort(count($this->behaviorPackStack)); foreach($this->behaviorPackStack as $entry){ $this->putString($entry->getPackId()); $this->putString($entry->getVersion()); } $this->putLShort(count($this->resourcePackStack)); foreach($this->resourcePackStack as $entry){ $this->putString($entry->getPackId()); $this->putString($entry->getVersion()); } } public function handle(PocketEditionNetworkSession $session) : bool{ return $session->handleResourcePackStack($this); } }