zh_cn:documentation:fabric_mod_json
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
zh_cn:documentation:fabric_mod_json [2021/09/01 08:05] – created 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** 字段相同。见上。如:< | ||
- | " | ||
- | " | ||
- | { | ||
- | " | ||
- | " | ||
- | } | ||
- | ] | ||
- | </ | ||
- | |||
- | ==== 依赖解析 ==== | ||
- | The key of each entry of the objects below is a Mod ID of the dependency. | ||
- | |||
- | The value of each key is a string or array of strings declaring supported version ranges. In the case of an array, an " | ||
- | |||
- | In the case of all versions, * is a special string declaring that any version is matched by the range. In addition, exact string matches must be possible regardless of the version type. | ||
- | |||
- | * **depends** For dependencies required to run. Without them a game will crash. | ||
- | * **recommends** For dependencies not required to run. Without them a game will log a warning. | ||
- | * **suggests** For dependencies not required to run. Use this as a kind of metadata. | ||
- | * **breaks** For mods whose together with yours might cause a game crash. With them a game will crash. | ||
- | * **conflicts** For mods whose together with yours cause some kind of bugs, etc. With them a game will log a warning. | ||
- | ==== 元数据 ==== | ||
- | |||
- | * **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