mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-01-06 14:04:32 +08:00
parent
c7fad05bae
commit
2391b26bd6
@ -138,14 +138,27 @@ public final class CurseCompletionTask extends Task<Void> {
|
|||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
FileUtils.writeText(new File(root, "manifest.json"), JsonUtils.GSON.toJson(newManifest));
|
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())
|
for (CurseManifestFile file : newManifest.getFiles())
|
||||||
if (StringUtils.isNotBlank(file.getFileName())) {
|
if (StringUtils.isNotBlank(file.getFileName())) {
|
||||||
if (!modManager.hasSimpleMod(file.getFileName())) {
|
RemoteMod mod = CurseForgeRemoteModRepository.MODS.getModById(Integer.toString(file.getProjectID()));
|
||||||
FileDownloadTask task = new FileDownloadTask(file.getUrl(), modManager.getSimpleModPath(file.getFileName()).toFile());
|
File target;
|
||||||
task.setCacheRepository(dependency.getCacheRepository());
|
if (((CurseAddon) mod.getData()).getClassId() == 12) {
|
||||||
task.setCaching(true);
|
target = new File(resourcePacks, file.getFileName());
|
||||||
dependencies.add(task.withCounter("hmcl.modpack.download"));
|
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()) {
|
if (!dependencies.isEmpty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user