use of net.technicpack.minecraftcore.mojang.version.io.AssetIndex in project LauncherV3 by TechnicPack.
the class EnsureAssetsIndexTask method runTask.
@Override
public void runTask(InstallTasksQueue queue) throws IOException {
MojangVersion version = ((InstallTasksQueue<MojangVersion>) queue).getMetadata();
String assetKey = version.getAssetsKey();
if (assetKey == null || assetKey.isEmpty()) {
assetKey = "legacy";
}
String assetsUrl;
AssetIndex assetIndex = version.getAssetIndex();
if (assetIndex != null) {
assetsUrl = assetIndex.getUrl();
} else {
assetsUrl = MojangUtils.getAssetsIndex(assetKey);
}
File output = new File(assetsDirectory + File.separator + "indexes", assetKey + ".json");
(new File(output.getParent())).mkdirs();
IFileVerifier fileVerifier;
if (assetIndex != null && assetIndex.getSha1() != null)
fileVerifier = new SHA1FileVerifier(assetIndex.getSha1());
else
fileVerifier = new ValidJsonFileVerifier(MojangUtils.getGson());
if (!output.exists() || !fileVerifier.isFileValid(output)) {
downloadIndexQueue.addTask(new DownloadFileTask(assetsUrl, output, fileVerifier));
}
examineIndexQueue.addTask(new InstallMinecraftAssetsTask(modpack, assetsDirectory.getAbsolutePath(), output, checkAssetsQueue, downloadAssetsQueue, installAssetsQueue));
}
Aggregations