fix modrinth modpack install (#1702)

* fix modrinth modpack install

* fix NullPointerException
This commit is contained in:
Chikage0o0 2022-09-10 21:49:31 +08:00 committed by GitHub
parent 6a81f4d240
commit 5fe1ef899d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,6 +102,8 @@ public class ModrinthCompletionTask extends Task<Void> {
Path runDirectory = repository.getRunDirectory(version).toPath();
for (ModrinthManifest.File file : manifest.getFiles()) {
if (file.getEnv() != null && file.getEnv().getOrDefault("client", "required").equals("unsupported"))
continue;
Path filePath = runDirectory.resolve(file.getPath());
if (!Files.exists(filePath) && !file.getDownloads().isEmpty()) {
FileDownloadTask task = new FileDownloadTask(file.getDownloads().get(0), filePath.toFile());