teddyxlandlee
本帖最后由 teddyxlandlee 于 2023-10-13 01:15 编辑

移动端用户请以桌面端模式访问此帖
Remote Resource Pack —— 远程资源包
移动端用户请以桌面端模式访问此帖
本模组允许你从互联网上下载子文件“组装”成资源包。

Q: 我要它有何用?

有些玩家/模组/整合包需要让其资源保持最新(比如时常更新语言文件、新闻等)

此外,有些资源不便直接分发(可能有法律风险),就需要在运行时下载。

配置文件格式

将JSON格式的配置文件扔进 .minecraft/config/RemoteResourcePack/ 文件夹(或者其子文件夹也行),后缀为 .json。

下面给出一个例子,请注意真正编写的时候是不允许有注释的,在此仅供演示。
{
  "schema": 1,          // 这个别动
  // 下载的文件过多长时间会过期(要重新下载)
  // e.g. 2min / 3d / 11h45min14s
  // 可设置为 "always"(每次启动都重新下载) 或  "never" (一次性资源,不用更新)
  "autoUpdate": "2h",
  // 资源包 zipconfig 文件,控制资源包 ZIP 文件中包含哪些文件
  "zipconfig": "https://featurehouse.github.io/epx_packs/v2/dl/zipconfig.json",
  "args": {             // 动态内容参数
    "poem": "random",   // 可以是字符串 "random",代表下载时随机选取
    "splashes": 0       // 也可以是个数值作为索引
  },
  // 远程资源的父 URL(如果它们是相对路径的话)
  "base": "https://featurehouse.github.io/epx_packs/v2/dl/index.html"
}复制代码


zipconfig 格式(还是不能写注释的)

{
    "static": { // 无论如何都包括这些文件
        "pack.mcmeta": {                // 可以直接把文件粘上来,记得给双引号和反斜杠打转义符
            "raw": "{"pack":{"pack_format":18,"description":"Hello World"}}"
        },
        "assets/example/test.bin": {    // 可为 base64 格式
            "base64": "TmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAh"
        },
        "assets/example/songs/dynamic/rickroll.ogg": {  // 可以从互联网下载
            "fetch": "https://www.example.net/songs/Rick%20Astley/Never_Gonna_Give_You_Up-HiRes.ogg"
        },
        "assets/example/lang/fr_fr.json": {     // 可以是相对路径,父 URL 由上面的配置文件 base 键定义
            "fetch": "/my-interesting-example-mod/resources/i18n/fr_fr.json"
        }
    },
    "dynamic": {
        "example-arg": {    // 详见配置文件的 args 栏
            "default": "random",    // 随机选一个,可以被 args[example-arg] 选项覆盖
            "items": [{
                "weight": 250,      // 可省略,默认值为 100
                "files": {  // 跟 static 是一样的!
                    "assets/example/news/content.json": {"fetch": "/my-interesting-example-mod/news-channel/1.json"},
                    "assets/example/news/timestamp.txt": {"raw": "2023-10-10T09:24:30+08:00"}
                }
            }, {
                "files": {
                    "assets/example/news/content.json": {"fetch": "/my-interesting-example-mod/news-channel/2.json"},
                    "assets/example/news/timestamp.txt": {"raw": "2023-10-10T09:25:21+08:00"}
                }
            }]
        },
        "another_arg": {
            "default": 0,
            "items": [
                {},
                {
                    "files": {
                        "assets/example/textures/items/silver_ingot.png": {
                            "fetch": "/my-interesting-example-mod/experimental/resources/silver_ingot/2023-10-10.png"
                        }
                    }
                }
            ]
        }
    }
}复制代码


模组内置配置

其他模组可以在 JAR 包根目录的 RemoteResourcePack.json 包含其自带配置,以此为例:

{
  "end-poem-extension/recommended-pack-v2.json": {
    "schema": 1,
    "_description": [
      "End Poem Extension Recommended Pack",
      "Contents may differ between downloads as they are picked randomly"
    ],
    "autoUpdate": "2h",
    "args": {
      "poem": "random",
      "splashes": 0
    },
    "base": "https://featurehouse.github.io/epx_packs/v2/dl/index.html",
    "zipconfig": "https://featurehouse.github.io/epx_packs/v2/dl/zipconfig.json"
  }
}复制代码


在此例中,里面包含的配置文件会被拷贝到 .minecraft/config/RemoteResourcePack/end-poem-extension/recommended-pack-v2.json (如果该文件不存在),然后被加载。

下载

带我去 Modrinth 下载
Forge 无须任何前置,Fabric/Quilt 建议安装 Fabric API/QSL 但不强制,不影响主要功能

第一页 上一页 下一页 最后一页