Re-download mod jar in InstanceLauncher if missing

This commit is contained in:
Johannes Frohnmeyer 2021-12-25 22:49:24 +01:00
parent 56e7b0194b
commit 9200ee2e2e
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 4 additions and 2 deletions

View File

@ -71,10 +71,12 @@ public class InstanceLauncher {
String fn = imod.getFileName().toString();
if (Files.exists(imod.getParent().resolve(fn.substring(0, fn.length() - 5))))
continue;
//TODO load imod from libraries via -Dfabric.addMods
Map<ModSource, Optional<ModSource>> sources = Utils.loadObject(imod, ModDescription.class).sources;
if (sources.isEmpty()) throw new LaunchException(".imod without attached jar contains no sources");
fabricAddMods.append(List.copyOf(sources.keySet()).get(0).getJarPath().toAbsolutePath());
ModSource ms = List.copyOf(sources.keySet()).get(0);
Path p = ms.getJarPath().toAbsolutePath();
if (!Files.exists(p)) ms.download();
fabricAddMods.append(p);
fabricAddMods.append(File.pathSeparatorChar);
}
}