From fa9fe18215bd5ac27050137b3fd7cf29d29ea0d1 Mon Sep 17 00:00:00 2001 From: comp500 Date: Mon, 2 Jan 2023 21:15:48 +0000 Subject: [PATCH] Fix manual link resolution for files not visible in CF API (fixes #48) --- .../installer/metadata/curseforge/CurseForgeSourcer.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/kotlin/link/infra/packwiz/installer/metadata/curseforge/CurseForgeSourcer.kt b/src/main/kotlin/link/infra/packwiz/installer/metadata/curseforge/CurseForgeSourcer.kt index db3338c..4392f75 100644 --- a/src/main/kotlin/link/infra/packwiz/installer/metadata/curseforge/CurseForgeSourcer.kt +++ b/src/main/kotlin/link/infra/packwiz/installer/metadata/curseforge/CurseForgeSourcer.kt @@ -97,6 +97,16 @@ fun resolveCfMetadata(mods: List, packFolder: PackwizFilePath, c } } + // Some file types don't show up in the API at all! (e.g. shaderpacks) + // Add unresolved files to manualDownloadMods + for ((fileId, file) in fileIdMap) { + if (file.linkedFile != null) { + if (file.linkedFile!!.resolvedUpdateData["curseforge"] == null) { + manualDownloadMods[(file.linkedFile!!.update["curseforge"] as CurseForgeUpdateData).projectId] = Pair(file, fileId) + } + } + } + if (manualDownloadMods.isNotEmpty()) { val reqModsData = GetModsRequest(manualDownloadMods.keys.toList()) val reqMods = Request.Builder()