zh_cn:documentation:fabric_mod_json
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
zh_cn:documentation:fabric_mod_json [2021/09/01 08:12] – [依赖解析] solidblock | zh_cn:documentation:fabric_mod_json [2024/01/02 10:33] – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== fabric.mod.json ====== | ||
- | fabric.mod.json 文件是由 Fabric 加载器使用以加载模组的模组元数据文件。模组需要有这个文件才能被加载,该文件需要放在模组 JAR 的根目录下,且名称一致。 | ||
- | ===== 必要字段 ===== | ||
- | |||
- | * **schemaVersion** 用于内部机制。总是为 '' | ||
- | * **id** 定义模组的 id——由字母、数字、下划线组成的字符串,长度为 1 到 63。。 | ||
- | * **version** 定义模组版本——字符串值,建议符合 [[https:// | ||
- | |||
- | ===== 可选字段 ===== | ||
- | |||
- | ==== 模组加载 ==== | ||
- | |||
- | * **environment**:定义了模组在哪里运行:只在客户端(客户端模组),或只在服务端(插件),或二者(常规模组)。包含环境标识符: | ||
- | * **'' | ||
- | * **client** 运行在客户端。 | ||
- | * **server** 运行在服务端。 | ||
- | * **entrypoints** 定义了你的模组的要加载的主要的类。 | ||
- | * 你的模组有三种默认的入口点: | ||
- | * **main** 会先运行。用于实现了 '' | ||
- | * **client** 仅在客户端,会随后运行。用于实现了 '' | ||
- | * **server** 仅在服务端,会随后运行。用于实现了 '' | ||
- | * 每个入口点都可以包含多个需要加载的模组。类(或者方法,或者静态字段)可以用两种方式定义: | ||
- | * 如果使用Java,列举类(或者其他)的完整名称。例如:< | ||
- | " | ||
- | " | ||
- | " | ||
- | ] | ||
- | </ | ||
- | * 如果你使用其他语言,参考该语言的文档。Kotlin 的位于 [[https:// | ||
- | |||
- | * **jars** 你的模组 JAR 中需要加载的嵌套 JAR。使用此字段前,请参考[[zh_cn: | ||
- | " | ||
- | { | ||
- | " | ||
- | } | ||
- | ] | ||
- | </ | ||
- | * **languageAdapters** 从使用的语言映射到其接收器(adapter)类完整名称的字典。例如:< | ||
- | " | ||
- | " | ||
- | } | ||
- | </ | ||
- | * **mixins** mixin配置文件的列表。每一项都是到你的模组 JAR 内的 mixin 配置文件的路径,或者包含以下字段的对象: | ||
- | * **config** 你的模组 JAR 内到 mixin 配置文件的路径。 | ||
- | * **environment** 与上层 **environment** 字段相同。见上。如:< | ||
- | " | ||
- | " | ||
- | { | ||
- | " | ||
- | " | ||
- | } | ||
- | ] | ||
- | </ | ||
- | |||
- | ==== 依赖解析 ==== | ||
- | 下方各对象的项的键均为依赖的模组 id。 | ||
- | |||
- | 每一个键的值都是字符串,或者字符串数组,声明支持的版本范围。对于数组,会假定一个“OR”关系——也就是说,只要符合其中一个。 | ||
- | |||
- | 对于所有版本的情况,*是特殊的字符串,声明所有版本都符合该范围。此外,无论版本范围,必须能够符合准确字符串。 | ||
- | |||
- | * **depends** 需要才能运行的依赖,否则游戏崩溃。 | ||
- | * **recommends** 不必要就能运行的依赖,否则游戏会输出警告。 | ||
- | * **suggests** 不需要就能运行的依赖,用作元数据。 | ||
- | * **breaks** 一起运行可能导致游戏崩溃的模组。一起运行时,游戏崩溃。 | ||
- | * **conflicts** 一起运行时游戏可能出现问题的模组。一起运行时,会输出警告。 | ||
- | ==== 元数据 ==== | ||
- | |||
- | * **name** Defines the user-friendly mod's name. If not present, assume it matches **id**. | ||
- | * **description** Defines the mod's description. If not present, assume empty string. | ||
- | * **contact** Defines the contact information for the project. It is an object of the following fields: | ||
- | * **email** Contact e-mail pertaining to the mod. Must be a valid e-mail address. | ||
- | * **irc** IRC channel pertaining to the mod. Must be of a valid URL format - for example: '' | ||
- | * **homepage** Project or user homepage. Must be a valid HTTP/HTTPS address. | ||
- | * **issues** Project issue tracker. Must be a valid HTTP/HTTPS address. | ||
- | * **sources** Project source code repository. Must be a valid URL - it can, however, be a specialized URL for a given VCS (such as Git or Mercurial). | ||
- | * The list is not exhaustive - mods may provide additional, non-standard keys (such as **discord**, | ||
- | * **authors** A list of authors of the mod. Each entry is a single name or an object containing following fields: | ||
- | * **name** The real name, or username, of the person. Mandatory. | ||
- | * **contact** Person' | ||
- | * **contributors** A list of contributors to the mod. Each entry is the same as in **author** field. See above. | ||
- | * **license** Defines the licensing information. Can either be a single license string or a list of them. | ||
- | * This should provide the complete set of preferred licenses conveying the entire mod package. In other words, compliance with all listed licenses should be sufficient for usage, redistribution, | ||
- | * For cases where a part of code is dual-licensed, | ||
- | * To aid automated tools, it is recommended to use [[https:// | ||
- | * **icon** Defines the mod's icon. Icons are square PNG files. (Minecraft resource packs use 128×128, but that is not a hard requirement - a power of two is, however, recommended.) Can be provided in one of two forms: | ||
- | * A path to a single PNG file. | ||
- | * A dictionary of images widths to their files' paths. | ||
- | |||
- | ===== 自定义字段 ===== | ||
- | |||
- | You can add any field you want to add inside '' |
zh_cn/documentation/fabric_mod_json.txt · Last modified: 2024/01/02 10:33 by solidblock