Search in sources :

Example 1 with ChainVersionBuilder

use of net.technicpack.minecraftcore.mojang.version.chain.ChainVersionBuilder in project LauncherV3 by TechnicPack.

the class Installer method createVersionBuilder.

private MojangVersionBuilder createVersionBuilder(ModpackModel modpack, InstallTasksQueue tasksQueue) {
    ZipFileRetriever zipVersionRetriever = new ZipFileRetriever(new File(modpack.getBinDir(), "modpack.jar"));
    HttpFileRetriever fallbackVersionRetriever = new HttpFileRetriever(TechnicConstants.technicVersions, tasksQueue.getDownloadListener());
    ArrayList<MojangVersionRetriever> fallbackRetrievers = new ArrayList<MojangVersionRetriever>(1);
    fallbackRetrievers.add(fallbackVersionRetriever);
    File versionJson = new File(modpack.getBinDir(), "version.json");
    // This always gets the version.json from the modpack.jar (it ignores "key"), cached as bin/version.json
    FileVersionBuilder zipVersionBuilder = new FileVersionBuilder(versionJson, zipVersionRetriever, fallbackRetrievers);
    // This gets the "key" from bin/$key.json if it exists, otherwise it downloads it from our repo into that location
    FileVersionBuilder webVersionBuilder = new FileVersionBuilder(modpack.getBinDir(), null, fallbackRetrievers);
    return new ChainVersionBuilder(zipVersionBuilder, webVersionBuilder);
}
Also used : ZipFileRetriever(net.technicpack.minecraftcore.mojang.version.builder.retrievers.ZipFileRetriever) FileVersionBuilder(net.technicpack.minecraftcore.mojang.version.builder.FileVersionBuilder) ArrayList(java.util.ArrayList) ChainVersionBuilder(net.technicpack.minecraftcore.mojang.version.chain.ChainVersionBuilder) File(java.io.File) HttpFileRetriever(net.technicpack.minecraftcore.mojang.version.builder.retrievers.HttpFileRetriever) MojangVersionRetriever(net.technicpack.minecraftcore.mojang.version.builder.MojangVersionRetriever)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 FileVersionBuilder (net.technicpack.minecraftcore.mojang.version.builder.FileVersionBuilder)1 MojangVersionRetriever (net.technicpack.minecraftcore.mojang.version.builder.MojangVersionRetriever)1 HttpFileRetriever (net.technicpack.minecraftcore.mojang.version.builder.retrievers.HttpFileRetriever)1 ZipFileRetriever (net.technicpack.minecraftcore.mojang.version.builder.retrievers.ZipFileRetriever)1 ChainVersionBuilder (net.technicpack.minecraftcore.mojang.version.chain.ChainVersionBuilder)1