Allow specifying a key for encrypted resource packs (#5297)

This commit is contained in:
BrandPVP
2022-09-28 19:27:33 +03:00
committed by GitHub
parent 1c7b1e9e5d
commit b21cd82e94
3 changed files with 39 additions and 2 deletions

View File

@ -65,9 +65,19 @@ class ResourcePacksPacketHandler extends PacketHandler{
){}
public function setUp() : void{
$resourcePackEntries = array_map(static function(ResourcePack $pack) : ResourcePackInfoEntry{
$resourcePackEntries = array_map(function(ResourcePack $pack) : ResourcePackInfoEntry{
//TODO: more stuff
return new ResourcePackInfoEntry($pack->getPackId(), $pack->getPackVersion(), $pack->getPackSize(), "", "", "", false);
$encryptionKey = $this->resourcePackManager->getPackEncryptionKey($pack->getPackId());
return new ResourcePackInfoEntry(
$pack->getPackId(),
$pack->getPackVersion(),
$pack->getPackSize(),
$encryptionKey ?? "",
"",
$pack->getPackId(),
false
);
}, $this->resourcePackManager->getResourceStack());
//TODO: support forcing server packs
$this->session->sendDataPacket(ResourcePacksInfoPacket::create($resourcePackEntries, [], $this->resourcePackManager->resourcePacksRequired(), false, false));