Skip to content

Creating Modpacks

sk89q edited this page Jul 20, 2015 · 49 revisions

Before we go create a modpack from scratch, let's examine the same ones and see how they are structured.

Starting with the Examples

Inside sample-files, you will find two example modpacks:

  • "lightpack"
  • "monsterpack"

Sample Files

Explanation

In the folder for each modpack, you will find:

  • modpack.json has basic information about the modpack:
    • "name" is the folder name for the modpack on the client, so it should not contain any funky symbols
    • "title" can be anything, however, and it is the name of the modpack shown in the client
    • "gameVersion" is a valid Minecraft version
    • "launch" -> "flags" is a list of Java flags that will be added by the client
    • "userFiles" -> "include" specifies the files that will never be overwritten on update
  • loaders/ contains various installers (NOT -universal versions) of mod loaders, like Forge, LiteLoader, etc. This folder is blank if you have a vanilla modpack.
  • src/ is what will go on the user's computer for the modpack.

Updating from an old launcher version? Make sure to remove version.json because the modpack tool generates it automatically now. If you leave it, the modpack tool will use your version file instead, and you may encounter problems if your file is incorrect.

Client and Server Files

Because the launcher handles both server and client modpacks, there needs to be a way for you to tell the launcher which ones are server-only and which ones are client-only.

Within src/, you will find "_CLIENT" and "_SERVER" folders. These can go anywhere and they "disappear" from the final directories. If you put a file in _CLIENT, then the file will only appear on the client; likewise for _SERVER.

In the sample project, you will find a _CLIENT and _SERVER used throughout.

It is possible to place a _CLIENT folder into a _SERVER folder (or vice versa) but this would be pointless and make the file disappear entirely.

If you only plan to make a client modpack, then you don't have to use these folders.

_CLIENT and _SERVER Example

Optional Features

You can make some files optional. For an example of this, browse to sample-files/lightpack/src/mods/_CLIENT.

Optional Files Example

Find two files:

  • CoolGrass.info.json
  • SomeMinimap.info.json

Inside those files, you will find something like:

{
  "feature": {
    "name": "SomeMinimap",
    "description": "SomeMinimap gives you a cool minimap.",
    "recommendation": "starred",
    "selected": true
  }
}
  • "name" is the name of the "feature"
  • "description" is a short description that the user can read
  • "recommendation" can be omitted, or it can be starred or avoid
  • "selected" can be true to have it selected by default or false to have it unselected by default

How do you name these files? Since the .jar is CoolGrass-1.0.jar, you can name it:

  • CoolGrass-1.0.jar.info.json
  • CoolGrass-1.0.info.json
  • CoolGrass-1.info.json
  • CoolGrass.info.json
  • CoolGra.info.json
  • CoOlGRa.info.json

As you see, you can simply use the prefix of the file that you want to make optional.

Note: If you want to make optional features that cover several files (in different places), read Optional Features. However, you can't have one feature depend on a second feature at the moment.

Download from a Custom URL

If you have some mod that you want to have the launcher download from a custom URL (other than your website), you can create a ".url.txt" file alongside the .jar, as illustrated below.

Custom URL

In the file, you'd put the URL:

URL

You may want to do this if the mod author asks you to redirect downloads to his or her own site, as it may record statistics.

Note: You need to make sure that the .jar that you have is the exact same version as the one at the URL, otherwise the launcher may keep redownloading the file because it thinks the downloaded file has been corrupted since last update.

Creating a Modpack

Create your own folder and create:

  • modpack.json (copy it from below and change it)
  • loaders/ folder
  • src/ folder
{
  "name": "Light Modpack",
  "title": "Light Modpack",
  "gameVersion": "1.8",
  "launch": {
    "flags": [
      "-Dfml.ignoreInvalidMinecraftCertificates=true"
    ]
  },
  "userFiles": {
    "include": [
      "options.txt",
      "optionsshaders.txt",
      "mods/VoxelMods/*"
    ]
  }
}

Put installers (NOT universal versions) into loaders/ and the modpack into src/.

Custom Modpack

Loaders

Using the Build Tools GUI

The easiest way to test and build your modpack is the build tools program that comes with the launcher. You should find this (after compiling the launcher, which you already have done) in build-tools/build/libs. To use it, copy the "build-tools-X.X.X-SNAPSHOT-all.jar" file to your modpack's folder (the one with modpack.json).

Warning: Java 8+ is required for the GUI.

Double click the .jar to run it, and you should be shown the following interface:

Build Tools GUI

Testing

To test your modpack, simply click "Run Modpack." This uses the actual launcher to run the game and will put you in offline mode.

You can click "Test Launcher Options" if you want to adjust memory options for your test instance.

All the files needed to run the test launcher go into a staging/ folder within your modpack folder, which is all temporary and you can delete whenever you don't need them anymore.

If you want to test the modpack as someone who is installing the modpack for the first time, close the test launcher if it's open, click "Delete Instance from Test Launcher," and run the modpack again.

Building

To build the modpack for release, click "Build for Release".

Build Modpack Dialog

You'll need to choose a version for this release. Every time you push an update, you have to change this value to something else entirely so that the launcher can compare it with the currently installed version to discover the update. By default, the current date and time is filled in for you, which you are free to use.

The manifest filename is for the specific modpack. You can keep this value the same for every update for the same modpack, and the field should already be pre-filled in for you based on the "name" field from modpack.json.

Clicking "Build..." will create the files that you upload to your server. The generated files should appear in a upload/ folder in the same folder as the modpack, although the tool should open a file browser at that directory when it's done to help you find it.

Building Using the Command Line

If you are planning to only use the GUI, you can skip this section. Otherwise, this section details how you can build the modpack just using command line tools, which can be more easily integrated into other tools.

  1. From the launcher-builder/build/libs/ folder, copy launcher-builder-X.Y.Z-SNAPSHOT-all.jar to your modpack's folder.
  2. Open terminal or command prompt and navigate to the directory of your modpack.
    • Windows users: Hold down your SHIFT key, right click the folder that contains "modpack.json", and click "Open command window here".
  3. Run the following command (note: put it on one line, and change "X.Y.Z" to the right version):
java -jar launcher-builder-X.Y.Z-SNAPSHOT-all.jar 
	--version "pick_a_version"
	--input . 
	--output upload 
	--manifest-dest "upload/your_modpack.json" 
  • "version" is the version of your modpack and it doesn't have to be a number -- whenever you want to push an update, you have to change the version code to anything else that has never been used before
  • "input" is the folder with "loaders," "src," and "modpack.json" -- . means "the current folder"
  • "output" is the folder to put the output
  • "manifest-dest" is the manifest file that is generated

Command Prompt

There should be a upload/ folder now with the generated files.

Generated Files

Uploading the Files

Upload the contents of upload/ to your website to the same place that you uploaded sample-files/upload/ (merging "objects" and "libraries").

Warning: If you are using FTP to upload, remember to switch your client to "binary mode."

If you have previously uploaded the modpack, you can skip existing files.

Updating the Package Listing

The package listing file links to the modpacks available.

  • If you are using the PHP version (packages.php), then you don't have to do anything. Skip this section.
  • If you are using the .json version (packages.json), you manually have to update it.

To update it, add you modpack to the list, possibly removing the others:

{
    "minimumVersion": 1,
    "packages": [
        {
            "name": "Your Modpack",
            "title": "Light Modpack",
            "version": "pick_a_version",
            "location": "your_modpack.json",
            "priority": 1
        }
    ]
}

Testing

Run the launcher (the -all.jar in launcher/build/libs) and see if your newly created modpack works.

How to Do Modpack Updates

To do updates:

  1. Build the modpack (as in run the program) the same way that you did above.
  2. Upload changed files from upload/. You do not need to worry about conflicts.
  3. If you are not using the automatic PHP version: change the version of the modpack in package.json.

Warning: If you use something like CloudFlare, it will cache files so your new version will not take effect. You may have to purge the cache.

Tip: For more permanent installations, you can make it all automatic by using a continuous integration server like Jenkins or TeamCity.

Multiple Modpacks

If you have multiple modpacks, you still upload everything to the same folder, merging "objects" and "libraries". Just make sure that the package listing file lists all the modpacks.

You can see this in the sample project: sample-files/upload/ contains files for both light and monster modpacks and package.json links to both.

Next Steps

At this point,

  • You may want to replace all the images in launcher/src/main/resources/com/skcraft/launcher/ if you have not done so yet.
  • You may want to change the name of the launcher in launcher/src/main/resources/com/skcraft/launcher/lang/Launcher.properties if you have not done so yet.

You can now release the launcher (the -all.jar in launcher/build/libs), but you may want to use the bootstrapper instead which can handle self-updating of the launcher. See Configuring-Self-Update.

Clone this wiki locally