ModUpdater/MOD_DEVELOPER.md

3.4 KiB

Mod Developers

To opt-in a mod for ModUpdater, you must select an update strategy in fabric.mod.json.

CurseForge

This update strategy uses the CurseForge API to check for updates.

fabric.mod.json

{
    "custom": {
        "modupdater": {
            "strategy": "curseforge",
            "projectID": 306612
        }
    }
}

GitHub Releases

This update strategy uses the GitHub Releases API to check for updates.

fabric.mod.json

{
    "custom": {
        "modupdater": {
            "strategy": "github",
            "owner": "Repository Owner",
            "repository": "Repository Name"
        }
    }
}

Maven

This update strategy uses the specified Maven repository to check for updates.

fabric.mod.json

{
    "custom": {
        "modupdater": {
            "strategy": "maven",
            "repository": "https://maven.fabricmc.net",
            "group": "net.fabricmc.fabric-api",
            "artifact": "fabric-api"
        }
    }
}

JSON

This update strategy uses the specified JSON file to check for updates.

fabric.mod.json

{
    "custom": {
        "modupdater": {
            "strategy": "json",
            "url": "https://example.com/thing.json"
        }
    }
}

JSON Format

{
    "1.16.1": {
        "version": "1.0.1",
        "downloadUrl": "https://example.com/thing2.jar"
    },
    "20w20a": {
        "version": "1.0.0",
        "downloadUrl": "https://example.com/thing.jar"
    }
}
  • Does Not Use Semantic Versioning
    • A mod is marked as out-of-date if the version in the JSON is different from the current version, so if the current version is newer than the one in the JSON, it will still be marked as out-of-date.
  • build.gradle Modification Is Not Required

build.gradle Modification

Multiple update strategies require the Minecraft version to be appended to the end of the JAR version to detect what Minecraft version a JAR supports.

Replace:

version = project.mod_version

with:

version = "${project.mod_version}+${project.minecraft_version}"

If you prefer hyphens you can also use:

version = "${project.mod_version}-${project.minecraft_version}"

Loose VS Strict Versioning Mode

Strict (Default)

In strict mode it only marks a file as compatibleif the Minecraft version is identical.

Loose

{
    "custom": {
        "modupdater": {
            "strict": false
        }
    }
}

In loose mode, it will also mark a file as compatible if it has the same release target.

Custom Version Compatibility Checking

You can also specify the modupdater entry-point as a ModUpdaterEntryPoint to check if a version is compatible with the current MC version.

repositories {
    maven { url 'https://maven.thebrokenrail.com' }
}
dependencies {
    modCompileOnly 'com.thebrokenrail:modupdater:VERSION'
    // VERSION = "<Mod Version>+<MC Version>", for example "1.2.4+20w12a"
}