Package net.ftb.data

Examples of net.ftb.data.ModPack


            List<DownloadInfo> list = Lists.newArrayList();
            Boolean forceUpdate = Settings.getSettings().isForceUpdateEnabled();
            File local;
            //Pack JSON Libraries
            Logger.logDebug("Checking pack libraries");
            ModPack pack = ModPack.getSelectedPack();
            File packDir = new File(installDir, pack.getDir());
            File gameDir = new File(packDir, "minecraft");
            File libDir = new File(installDir, "libraries");
            // if (!pack.getDir().equals("mojang_vanilla")) {
            if (!pack.getDir().equals("mojang_vanilla")) {
                if (isLegacy) {
                    extractLegacyJson(new File(gameDir, "pack.json"));
                }
            }

            if (new File(gameDir, "pack.json").exists()) {
                Version packjson = JsonFactory.loadVersion(new File(gameDir, "pack.json"));
                if (packjson.jar != null && !packjson.jar.isEmpty()) {
                    packmcversion = packjson.jar;
                }
                if (packjson.inheritsFrom != null && !packjson.inheritsFrom.isEmpty()) {
                    packbasejson = packjson.inheritsFrom;
                }
                Library.Artifact a;
                for (Library lib : packjson.getLibraries()) {
                    //Logger.logError(new File(libDir, lib.getPath()).getAbsolutePath());
                    // These files are shipped inside pack.zip, can't do force update check yet
                    local = new File(root, "libraries/" + lib.getPath());
                    if (!new File(libDir, lib.getPath()).exists() || forceUpdate) {
                        if (lib.checksums != null) {
                            list.add(new DownloadInfo(new URL(lib.getUrl() + lib.getPath()), local, lib.getPath(), lib.checksums, "sha1",
                                    DownloadInfo.DLType.NONE, DownloadInfo.DLType.NONE));
                        } else if (lib.download != null && lib.download) {
                            list.add(new DownloadInfo(new URL(lib.getUrl() + lib.getPath()), local, lib.getPath()));
                        }
                    }
                    a = lib.get_artifact();
                    if (a.getDomain().equalsIgnoreCase("net.minecraftforge") && (a.getName().equalsIgnoreCase("forge") || a.getName().equalsIgnoreCase("minecraftforge"))) {
                        grabJava8CompatFix(a, pack, packmcversion, installDir + "/" + pack.getDir());
                    }
                }
                //}
            } else {
                if (!pack.getDir().equals("mojang_vanilla")) {
                    Logger.logError("pack.json file not found-Forge/Liteloader will not be able to load!");
                } else {
                    Logger.logInfo("pack.json not found in vanilla pack(this is expected)");
                }
                //TODO handle vanilla packs w/ tweakers w/ this stuffs !!!
View Full Code Here


     */
    public static void installMods (String modPackName) throws IOException {
        String installpath = Settings.getSettings().getInstallPath();
        String temppath = OSUtils.getCacheStorageLocation();

        ModPack pack;
        if (LaunchFrame.currentPane == LaunchFrame.Panes.THIRDPARTY) {
            pack = ModPack.getPack(LaunchFrame.getInstance().thirdPartyPane.getSelectedThirdPartyModIndex());
        } else {
            pack = ModPack.getPack(LaunchFrame.getInstance().modPacksPane.getSelectedFTBModIndex());
        }

        String packDir = pack.getDir();

        Logger.logInfo("dirs mk'd");

        File source = new File(temppath, "ModPacks/" + packDir + "/.minecraft");
        if (!source.exists()) {
View Full Code Here

            }
        });
    }

    private boolean upToDate () throws IOException {
        ModPack pack = ModPack.getSelectedPack();
        File version = new File(Settings.getSettings().getInstallPath(), pack.getDir() + sep + "version");
        if (!version.exists()) {
            version.getParentFile().mkdirs();
            version.createNewFile();
            curVersion = (Settings.getSettings().getPackVer().equalsIgnoreCase("recommended version") ? pack.getVersion() : Settings.getSettings().getPackVer()).replace(".", "_");
            return false;
        }
        BufferedReader in = new BufferedReader(new FileReader(version));
        String line = in.readLine();
        in.close();
        int currentVersion, requestedVersion;
        currentVersion = (line != null) ? Integer.parseInt(line.replace(".", "")) : 0;
        if (!Settings.getSettings().getPackVer().equalsIgnoreCase("recommended version") && !Settings.getSettings().getPackVer().equalsIgnoreCase("newest version")) {
            requestedVersion = Integer.parseInt(Settings.getSettings().getPackVer().trim().replace(".", ""));
            if (requestedVersion != currentVersion) {
                Logger.logInfo("Modpack is out of date.");
                curVersion = (Settings.getSettings().getPackVer().equalsIgnoreCase("recommended version") ? pack.getVersion() : Settings.getSettings().getPackVer()).replace(".", "_");
                return false;
            } else {
                Logger.logInfo("Modpack is up to date.");
                return true;
            }
        } else if (Integer.parseInt(pack.getVersion().replace(".", "")) != currentVersion) {
            Logger.logInfo("Modpack is out of date.");
            if (LaunchFrame.allowVersionChange) {
                curVersion = (Settings.getSettings().getPackVer().equalsIgnoreCase("recommended version") ? pack.getVersion().replace(".", "_") : Settings.getSettings().getPackVer())
                        .replace(".", "_");
                return false;
            }
            ModpackUpdateDialog p = new ModpackUpdateDialog(LaunchFrame.getInstance(), true);
            p.setVisible(true);
            if (!update) {
                return true;
            }
            if (backupCFG) {
                File destination = new File(OSUtils.getCacheStorageLocation(), "backups" + sep + pack.getDir() + sep + "config_backup");
                if (destination.exists()) {
                    FTBFileUtils.delete(destination);
                }
                FTBFileUtils.copyFolder(new File(Settings.getSettings().getInstallPath(), pack.getDir() + sep + "minecraft" + sep + "config"), destination);
            }
            if (backupSave) {
                File destination = new File(OSUtils.getCacheStorageLocation(), "backups" + sep + pack.getDir() + sep + "saves_backup");
                if (destination.exists()) {
                    FTBFileUtils.delete(destination);
                }
                FTBFileUtils.copyFolder(new File(Settings.getSettings().getInstallPath(), pack.getDir() + sep + "minecraft" + sep + "saves"), destination);
            }
            curVersion = pack.getVersion().replace(".", "_");
            return false;
        } else {
            Logger.logInfo("Modpack is up to date.");
            return true;
        }
View Full Code Here

            return true;
        }
    }

    public static void cleanUp () {
        ModPack pack = ModPack.getSelectedPack();
        File tempFolder = new File(OSUtils.getCacheStorageLocation(), "ModPacks" + sep + pack.getDir() + sep);
        for (String file : tempFolder.list()) {
            if (!file.equals(pack.getLogoName()) && !file.equals(pack.getImageName()) && !file.equals("version") && !file.equals(pack.getAnimation())) {
                try {
                    if (file.endsWith(".zip")) {
                        Logger.logDebug("retaining modpack file: " + tempFolder + File.separator + file);
                    } else {
                        FTBFileUtils.delete(new File(tempFolder, file));
View Full Code Here

TOP

Related Classes of net.ftb.data.ModPack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.