The Best Resource for Minecraft
The Best Resource for Minecraft

.mrpack 几乎不包含自身的模组

.mrpack 几乎不包含自身的模组

该文件是一个 ZIP,但 jar 并不在其中。它附带了一个包含 SHA-512 哈希值的下载 URL 清单,这就是为什么一个 40 KB 的整合包可以安装四百兆字节的内容——也是它在离线状态下会失败的原因。

重命名任意项 .mrpack to .zip, open it, and the surprise is how little is there. A pack with two hundred mods is often under 100 KB. The mods are not missing — they were never included.

内部到底包含什么

条目必需内容
modrinth.index.json清单:每个文件、其 路径、大小、哈希值与下载 URL
overrides/原样复制的实际文件——配置文件、 脚本、资源包
client-overrides/, server-overrides/ 相同的思路,仅应用于该端

清单包含一个 formatVersion, a dependencies map naming the loader and Minecraft version, and a files array. Each file entry holds the destination path, a fileSize, a hashes object with sha1 and sha512, an env block marking it required or optional per side, and one or more downloads URLs.

为何这样设计

重新分发。整合包作者几乎从未获得重新托管列表中每个模组的权限, 但他们始终可以指向作者本人的文件。提供 URL 而非 jar 可以让整合包合法分享,并保持足够小以便通过聊天软件发送。

哈希值是另一半关键。URL 明天可能就会提供不同的内容; 而 SHA-512 不会。在下载后验证哈希值的启动器会检查接收到的 文件是否与整合包作者测试时的文件逐字节完全一致。

出现问题的三种情况

  • 没有网络,就没有整合包。 一个 .mrpack is an installer, not an archive. Offline it produces a folder of configs and nothing else.
  • 失效的 URL 是致命错误,无法跳过。 如果某个模组被下架,该条目 仍会解析为 404,且安装会停在标记为必需的文件处。
  • 仅服务端和仅客户端文件。 将解包后的客户端实例复制 到服务端上,就会带入拒绝加载的客户端模组—— env flags exist precisely to keep those apart.

将其转换为普通文件夹

转换意味着执行启动器所做的工作:读取清单,将每个文件获取到其 声明的 path, verify each hash, then lay the overrides on top. What comes out is an ordinary mods/ tree you can drop into any launcher or upload to a host that has never heard of Modrinth.

手动操作时有两个细节值得注意。遵守 env flags so a server build does not inherit client mods. And check the hash rather than the file size — a truncated download and a redirected HTML error page can both land at a plausible size, and only the hash catches them.