Fix pre-1.6 assets being downloaded EVERY TIME

This commit is contained in:
Boulay Mathias 2022-07-16 02:19:46 +02:00
parent 73bd1cc30b
commit 081ad0d66f

View File

@ -465,10 +465,13 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
JAssetInfo asset = assetsObjects.get(assetKey); JAssetInfo asset = assetsObjects.get(assetKey);
assetsSizeBytes+=asset.size; assetsSizeBytes+=asset.size;
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash; String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash;
File outFile = assets.mapToResources ?new File(objectsDir,"/"+assetKey):new File(objectsDir, assetPath); File outFile = assets.mapToResources ?new File(outputDir,"/"+assetKey):new File(objectsDir, assetPath);
boolean skip = outFile.exists();// skip if the file exists boolean skip = outFile.exists();// skip if the file exists
if(LauncherPreferences.PREF_CHECK_LIBRARY_SHA) //if sha checking is enabled if(LauncherPreferences.PREF_CHECK_LIBRARY_SHA && skip){
if(skip) skip = Tools.compareSHA1(outFile, asset.hash); //check hash //if sha checking is enabled
skip = Tools.compareSHA1(outFile, asset.hash); //check hash
}
if(skip) { if(skip) {
downloadedSize.addAndGet(asset.size); downloadedSize.addAndGet(asset.size);
}else{ }else{