From 2391b26bd67c1c0c5e6f3fa1ab3f7484c9c3876e Mon Sep 17 00:00:00 2001 From: Burning_TNT <88144530+burningtnt@users.noreply.github.com> Date: Sun, 31 Dec 2023 21:54:19 +0800 Subject: [PATCH] Fix #1750 (#2580) --- .../hmcl/mod/curse/CurseCompletionTask.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseCompletionTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseCompletionTask.java index f8cd2dde2..bc357f548 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseCompletionTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseCompletionTask.java @@ -138,14 +138,27 @@ public final class CurseCompletionTask extends Task { .collect(Collectors.toList())); FileUtils.writeText(new File(root, "manifest.json"), JsonUtils.GSON.toJson(newManifest)); + File resourcePacks = new File(repository.getVersionRoot(modManager.getVersion()), "resourcepacks"); for (CurseManifestFile file : newManifest.getFiles()) if (StringUtils.isNotBlank(file.getFileName())) { - if (!modManager.hasSimpleMod(file.getFileName())) { - FileDownloadTask task = new FileDownloadTask(file.getUrl(), modManager.getSimpleModPath(file.getFileName()).toFile()); - task.setCacheRepository(dependency.getCacheRepository()); - task.setCaching(true); - dependencies.add(task.withCounter("hmcl.modpack.download")); + RemoteMod mod = CurseForgeRemoteModRepository.MODS.getModById(Integer.toString(file.getProjectID())); + File target; + if (((CurseAddon) mod.getData()).getClassId() == 12) { + target = new File(resourcePacks, file.getFileName()); + if (target.exists()) { + continue; + } + } else { + if (modManager.hasSimpleMod(file.getFileName())) { + continue; + } + target = modManager.getSimpleModPath(file.getFileName()).toFile(); } + + FileDownloadTask task = new FileDownloadTask(file.getUrl(), target); + task.setCacheRepository(dependency.getCacheRepository()); + task.setCaching(true); + dependencies.add(task.withCounter("hmcl.modpack.download")); } if (!dependencies.isEmpty()) {