鸭子更新器库

鸭子更新器库

用于从modrinth检查模组更新的简单库

基础库

Ducky Updater Lib

描述

用于从 Modrinth 检查模组更新的简单库。

添加依赖

build.gradle.kts

repositories {
    maven {
        url = "https://api.modrinth.com/maven"
    }
}

dependencies {
    // 选项 1: 将 Ducky Updater 包含到你的项目中,使其在你的 jar 中可用(额外增加约 17kb)
    include(modImplementation("maven.modrinth", "ducky-updater-lib", "<version>"))
    
    // 选项 2: 依赖 Ducky Updater,但需要用户手动安装
    modImplementation("maven.modrinth", "ducky-updater-lib", "<version>")
}

fabric.mod.json

{
  "depends": {
    "fabricloader": "*",
    ...
    // 同时在你的 fabric.mod.json 中添加依赖
    "ducky-updater": "*"
  }
}

使用方法

fabric.mod.json

{
  "custom": {
    ...
    "duckyupdater": {
      // 模组在项目页面上的 modrinth ID
      "modrinthId": "mWxGwd3F",
      // 可选(release、beta、alpha)
      // 默认为 release
      "type": "release",
      // 可选(true、false)
      // 默认 false
      "featured": false
    }
  },
}
2023.7.1 之前
public class ModName implements ModInitializer {
    @Override
    public void onInitialize() {
        DuckyUpdater.checkForUpdate(
                "modrinthId",
                "modId",
                "alpha",        // 可选!默认为 release
                true            // 可选!默认为 true
        );
    }
}