About Contact

Site Changelog
The tutorial text is All Rights Reserved. However, any code in the tutorial is Public Domain, feel free to use it in your own projects.

Releasing Your Mod

When your mod is ready for other people to play it, you'll want them be able to add it to their game rather than only running in a development environment. I'll review your options for distribution websites and give a tutorial on using gradle to automatically publish your mod.

Build

To build your mod's code into a jar file that can be loaded by minecraft, you simply run the build gradle task. This can be done from intellij or from the command line.

./gradlew build

Make sure you use cd to navigate to your mod project folder before running the command.
On windows, do not include the ./ at the beginning of the command.

When the task is finished running, your built jar file will be in the build/libs folder.

To install the mod, just drop that jar file in minecraft/mods and launch the game with forge installed.

Distribution Platforms

There are many websites that will let you upload your mods and make it easy for players to install them. If you want to give players the choice of what distribution platform they prefer, nothing's stopping you from uploading your mods to multiple websites.

Github

Github is a great place to host your mod's code if you want it to be open source. It also has "Github Releases" which lets you upload files and tag them as the release corresponding to a certain commit.

Github Releases Advantages:

Github Releases Disadvantages:

Curseforge

Curseforge has been the most popular website for hosting Minecraft mods for a long time.

Curseforge Advantages:

Curseforge Disadvantages:

Modrinth

Modrinth is an open source alternative to Curseforge.

Modrinth Advantages:

Modrinth Disadvantages:

Gradle Plugins

If you end up making several mods, it will eventually get irritating to have to click through the website's interface to upload a file every time you want to release some new content. Especially if you want to give players the choice of what distribution platform to use so you want to upload to multiple websites. If you get to that point, check out the following gradle plugins. With a bit of configuration, they'll give you a gradle task to automatically upload a new release.

JustEnoughPublishing

JustEnoughPublishing is a gradle script I wrote that uses the plugins above to release your mod based on a simple json configuration file. Personally I dislike copy pasting the plugin boiler plate across all my projects. Instead, I just put a one line script import in my build.gradle file which will set up everything based on a json file containing the project's settings. This script is less versatile than using the plugins directly so use whichever suits your situation best.

Usage

  1. import the script (bottom of build.gradle): apply from: "https://moddingtutorials.org/publish.gradle"
  2. create the config file as specified bellow
  3. define your api keys as environment variables and make sure you expose the required gradle properties (more info below)
  4. run gradlew publishMod whenever you want to publish a new version (can be done in a github action, example)

Config File

Location Options

  1. {root}/.github/publish.json
  2. {subproject}/publish.json
  3. {root}/publish.json):

The config file contains a json object with the following fields:

example

gradle.properties variables

Secrets

These are your api keys and should not be committed to your git repository. They can be set in USER_HOME_FOLDER/.gradle/gradle.properties or as environment variables. Each is only required if you defined that platform in your publish.json file.

Forge Version Checker



Got Questions? Join the Discord!

View Full Tutorial Code on Github!

Donate to Support Tutorial Creation!