indexesFolder.mkdirs();
virtualFolder.mkdirs();
try {
new Downloadable(MojangConstants.DOWNLOAD_BASE.getURL("indexes/" + assetVersion + ".json"), indexFile,
null, this, false).download(false);
AssetIndex index = (AssetIndex) this.gson.fromJson(new FileReader(indexFile), AssetIndex.class);
if (index.isVirtual()) {
virtualRoot.mkdirs();
}
for (Map.Entry<String, AssetObject> entry : index.getObjects().entrySet()) {
AssetObject object = entry.getValue();
String filename = object.getHash().substring(0, 2) + "/" + object.getHash();
File file = new File(objectsFolder, filename);
File virtualFile = new File(virtualRoot, entry.getKey());
if (object.needToDownload(file)) {
downloads.add(new Downloadable(MojangConstants.RESOURCES_BASE.getURL(filename), file,
object.getHash(), (int) object.getSize(), this, false, virtualFile, index.isVirtual()));
} else {
if (index.isVirtual()) {
virtualFile.mkdirs();
Utils.copyFile(file, virtualFile, true);
}
}
}