use of net.technicpack.minecraftcore.install.ModpackZipFilter in project LauncherV3 by TechnicPack.
the class CleanupAndExtractModpackTask method runTask.
@Override
public void runTask(InstallTasksQueue queue) throws IOException {
File modsDir = this.pack.getModsDir();
if (modsDir != null && modsDir.exists()) {
deleteMods(modsDir);
}
File coremodsDir = this.pack.getCoremodsDir();
if (coremodsDir != null && coremodsDir.exists()) {
deleteMods(coremodsDir);
}
// HACK - jamioflan is a big jerk who needs to put his mods in the dang mod directory!
File flansDir = new File(this.pack.getInstalledDirectory(), "Flan");
if (flansDir.exists()) {
deleteMods(flansDir);
}
File packOutput = this.pack.getInstalledDirectory();
IZipFileFilter zipFilter = new ModpackZipFilter(this.pack);
for (Mod mod : modpack.getMods()) {
String url = mod.getUrl();
String md5 = mod.getMd5();
String version = mod.getVersion();
String name;
if (version != null) {
name = mod.getName() + "-" + version + ".zip";
} else {
name = mod.getName() + ".zip";
}
File cache = new File(this.pack.getCacheDir(), name);
IFileVerifier verifier = null;
if (md5 != null && !md5.isEmpty())
verifier = new MD5FileVerifier(md5);
else
verifier = new ValidZipFileVerifier();
checkModQueue.addTask(new EnsureFileTask(cache, verifier, packOutput, url, downloadModQueue, copyModQueue, zipFilter));
}
copyModQueue.addTask(new CleanupModpackCacheTask(this.pack, modpack));
}
Aggregations