Package com.sk89q.skmcl.minecraft.model

Examples of com.sk89q.skmcl.minecraft.model.ReleaseManifest


        Identity identity = context.getIdentity();
        ObjectMapper mapper = new ObjectMapper();
        final File extractDir = createExtractDir();
        JavaProcessBuilder builder = new JavaProcessBuilder();
        ReleaseManifest manifest = mapper.readValue(
                getManifestPath(), ReleaseManifest.class);
        String clientToken = identity.getClientToken();

        // Add libraries to classpath or extract the libraries as necessary
        for (Library library : manifest.getLibraries()) {
            File path = new File(getLibrariesDir(), library.getPath(context.getEnvironment()));

            if (path.exists()) {
                Extract extract = library.getExtract();
                if (extract != null) {
                    ZipExtract zipExtract = new ZipExtract(
                            new FileResource(path), extractDir);
                    zipExtract.setExclude(extract.getExclude());
                    zipExtract.run();
                } else {
                    builder.classPath(path);
                }
            }
        }

        // Add arguments for the .jar
        String[] args = manifest.getMinecraftArguments().split(" +");
        for (String arg : args) {
            arg = arg.replace("${version_name}", manifest.getId());
            arg = arg.replace("${game_directory}", getProfile().getContentDir().getAbsolutePath());
            arg = arg.replace("${game_assets}", getAssetsDir().getAbsolutePath());
            arg = arg.replace("${auth_player_name}", identity.getName());
            arg = arg.replace("${auth_username}", identity.getName());
            arg = arg.replace("${auth_access_token}", identity.getAccessToken());
            arg = arg.replace("${auth_session}", clientToken);
            builder.getArgs().add(arg);
        }

        // Mac OS X arguments
        if (getEnvironment().getPlatform() == Platform.MAC_OS_X) {
            File icnsPath = new File(getAssetsDir(), "icons/minecraft.icns");
            builder.getFlags().add("-Xdock:icon=" + icnsPath.getAbsolutePath());
            builder.getFlags().add("-Xdock:name=Minecraft");
        }

        builder.getFlags().add("-Djava.library.path=" + extractDir.getAbsoluteFile());
        builder.classPath(getJarPatcher().getExecutedPath());
        builder.setMainClass(manifest.getMainClass());

        ProcessBuilder processBuilder = new ProcessBuilder(builder.buildCommand());
        processBuilder.directory(getProfile().getContentDir());
        Process process = processBuilder.start();
View Full Code Here


        File librariesDir = instance.getLibrariesDir();
        File jarPath = instance.getJarPath();
        File manifestPath = instance.getManifestPath();

        // Obtain the release manifest, save it, and parse it
        ReleaseManifest manifest = HttpRequest
                .get(getManifestUrl())
                .execute()
                .expectResponseCode(200)
                .returnContent()
                .saveContent(manifestPath)
                .asJson(ReleaseManifest.class);

        // If the JAR does not exist, install it
        if (!jarPath.exists()) {
            installer.copyTo(new HttpResource(manifest.getJarUrl()), jarPath);
        }

        // Install all the missing libraries
        for (Library library : manifest.getLibraries()) {
            if (library.matches(environment)) {
                URL url = library.getUrl(environment);
                File file = new File(librariesDir, library.getPath(environment));

                if (!file.exists()) {
View Full Code Here

TOP

Related Classes of com.sk89q.skmcl.minecraft.model.ReleaseManifest

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.