mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-10 12:26:16 -04:00
check the format of asset for 1.7.2~1.6.0.
This commit is contained in:
parent
9220a818b3
commit
e5acf99b09
@ -131,13 +131,19 @@ public class MinecraftLoader extends IMinecraftLoader {
|
|||||||
|
|
||||||
if (index.isVirtual()) {
|
if (index.isVirtual()) {
|
||||||
HMCLog.log("Reconstructing virtual assets folder at " + virtualRoot);
|
HMCLog.log("Reconstructing virtual assets folder at " + virtualRoot);
|
||||||
|
int tot = index.getFileMap().entrySet().size();
|
||||||
|
int cnt = 0;
|
||||||
for (Map.Entry entry : index.getFileMap().entrySet()) {
|
for (Map.Entry entry : index.getFileMap().entrySet()) {
|
||||||
File target = new File(virtualRoot, (String) entry.getKey());
|
File target = new File(virtualRoot, (String) entry.getKey());
|
||||||
File original = new File(new File(objectDir, ((AssetsObject) entry.getValue()).getHash().substring(0, 2)), ((AssetsObject) entry.getValue()).getHash());
|
File original = new File(new File(objectDir, ((AssetsObject) entry.getValue()).getHash().substring(0, 2)), ((AssetsObject) entry.getValue()).getHash());
|
||||||
|
if (original.exists()) {
|
||||||
if (!target.isFile())
|
cnt++;
|
||||||
FileUtils.copyFile(original, target, false);
|
if (!target.isFile())
|
||||||
|
FileUtils.copyFile(original, target, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// If the scale new format existent file is lower then 0.1, use the old format.
|
||||||
|
if (cnt * 10 < tot) return assetsDir;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
HMCLog.warn("Failed to create virutal assets.", e);
|
HMCLog.warn("Failed to create virutal assets.", e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user