use of net.technicpack.minecraftcore.mojang.version.io.GameDownloads in project LauncherV3 by TechnicPack.
the class InstallMinecraftIfNecessaryTask method runTask.
@Override
public void runTask(InstallTasksQueue queue) throws IOException, InterruptedException {
super.runTask(queue);
MojangVersion version = ((InstallTasksQueue<MojangVersion>) queue).getMetadata();
String url;
GameDownloads dls = version.getDownloads();
IFileVerifier verifier = null;
if (dls != null) {
url = dls.forClient().getUrl();
verifier = new SHA1FileVerifier(dls.forClient().getSha1());
} else {
url = MojangUtils.getOldVersionDownload(this.minecraftVersion);
Utils.getLogger().log(Level.SEVERE, "Using legacy Minecraft download! Version id = " + version.getId() + "; parent = " + version.getParentVersion());
String md5 = Utils.getETag(url);
if (md5 != null && !md5.isEmpty()) {
verifier = new MD5FileVerifier(md5);
} else {
verifier = new ValidZipFileVerifier();
}
}
File cache = new File(cacheDirectory, "minecraft_" + this.minecraftVersion + ".jar");
if (!cache.exists() || !verifier.isFileValid(cache)) {
String output = this.pack.getCacheDir() + File.separator + "minecraft.jar";
Utils.downloadFile(url, cache.getName(), output, cache, verifier, this);
}
MojangUtils.copyMinecraftJar(cache, new File(this.pack.getBinDir(), "minecraft.jar"));
}
Aggregations