Skip to content

Modifying CraftBoot

Hayden Schiff edited this page Apr 9, 2014 · 7 revisions

Note: This section requires some programming knowledge; proceed with caution!

If you would like to use a custom version of the launcher jar or if you would like to hard-code the launcher.properties URL instead of prompting the user for it, you can do so by modifying CraftBoot and compiling a custom version of it.

Compiling

This project is managed with Maven; to compile it, use the command:

mvn clean package

This project also requires Project Lombok; if you are using an IDE, you may need to manually add lombok.jar to your build path.

Changing storage directory

If you are making your own version of the launcher just for your modpack, you might want to set it to use a different directory. If your version of CraftBoot saved to "[home]/.yourmodpack/" instead of to "[home]/.craftboot/yourmodpack.jar/", your users would be able to freely rename the jar file without consequence.

To do this, simply open Craftboot.java and change the value of LAUNCHER_SUBDIR to something that makes sense for you, then set the makeDataDir() function to return craftbootDir instead of instanceDir (and remove all the code that becomes unused with this change).

Hard-coding launcher.properties URL

To hard-code a URL for your launcher.properties so your users don't have to manually enter it, modify the method prepareUserUrl() in Craftboot.java so that propertiesUrl is set to your URL of choice. You can remove everything related to downloading the URL, sending the user a dialog, and storing the ".craftbooturl" file.

Use custom launcher jar

To use your own version of the launcher jar, modify getLauncherUpdateUrl() in LauncherDownloader.java to return the URL of your choosing. The URL should point to a page containing a URL pointing to a Pack200-packed version of your launcher jar.

You will also need to modify your launcher.properties file to include a selfUpdateUrl, which must point to a JSON file formatted like the file on this page.

Other changes

If you have another idea for a modification that could improve CraftBoot, feel free to implement the change and send a pull request! I can't promise that I'll merge it, but if your code is solid and your change is useful, I'll definitely consider it. If you've got an idea that you want to discuss, feel free to create a new issue or send me a tweet.