use of net.technicpack.minecraftcore.mojang.java.JavaRuntime in project LauncherV3 by TechnicPack.
the class EnsureJavaRuntimeManifestTask method runTask.
@Override
public void runTask(InstallTasksQueue queue) throws IOException {
MojangVersion version = ((InstallTasksQueue<MojangVersion>) queue).getMetadata();
JavaVersion wantedRuntime = version.getJavaVersion();
if (wantedRuntime == null) {
// Nothing to do here, this version doesn't have a Mojang JRE
return;
}
final String runtimeName = wantedRuntime.getComponent();
JavaRuntimes availableRuntimes = MojangUtils.getJavaRuntimes();
if (availableRuntimes == null) {
throw new DownloadException("Failed to get Mojang JRE information");
}
JavaRuntime runtime = availableRuntimes.getRuntimeForCurrentOS(runtimeName);
Download manifest = runtime.getManifest();
File output = new File(runtimesDirectory + File.separator + "manifests", runtimeName + ".json");
(new File(output.getParent())).mkdirs();
IFileVerifier fileVerifier = new SHA1FileVerifier(manifest.getSha1());
if (!output.exists() || !fileVerifier.isFileValid(output)) {
examineJavaQueue.addTask(new DownloadFileTask(manifest.getUrl(), output, fileVerifier));
}
examineJavaQueue.addTask(new InstallJavaRuntimeTask(modpack, runtimesDirectory, output, runtimeName, examineJavaQueue, downloadJavaQueue));
}
Aggregations