User Tools

Site Tools


zh_cn:documentation:fabric_mod_json

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
zh_cn:documentation:fabric_mod_json [2021/09/01 08:05] – created solidblockzh_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** 用于内部机制。总是为 ''1'' 
-   * **id** 定义模组的 id——由字母、数字、下划线组成的字符串,长度为 1 到 63。。 
-   * **version** 定义模组版本——字符串值,建议符合 [[https://semver.org/|Semantic Versioning 2.0.0]] 的规定。 
- 
-===== 可选字段 ===== 
- 
-==== 模组加载 ==== 
- 
-   * **environment**:定义了模组在哪里运行:只在客户端(客户端模组),或只在服务端(插件),或二者(常规模组)。包含环境标识符: 
-      * **''*''** 运行在客户端与服务的。默认。 
-      * **client** 运行在客户端。 
-      * **server** 运行在服务端。 
-   * **entrypoints** 定义了你的模组的要加载的主要的类。 
-      * 你的模组有三种默认的入口点: 
-         * **main** 会先运行。用于实现了 ''ModInitializer'' 的类。 
-         * **client** 仅在客户端,会随后运行。用于实现了 ''ClientModInitializer'' 的类。 
-         * **server** 仅在服务端,会随后运行。用于实现了 ''DedicatedServerModInitializer'' 
-      * 每个入口点都可以包含多个需要加载的模组。类(或者方法,或者静态字段)可以用两种方式定义: 
-         * 如果使用Java,列举类(或者其他)的完整名称。例如:<code json> 
-"main": [ 
-    "net.fabricmc.example.ExampleMod", 
-    "net.fabricmc.example.ExampleMod::handle" 
-] 
-</code> 
-   * 如果你使用其他语言,参考该语言的文档。Kotlin 的位于 [[https://github.com/FabricMC/fabric-language-kotlin/blob/master/README.md|此网站]]。 
- 
-   * **jars** 你的模组 JAR 中需要加载的嵌套 JAR。使用此字段前,请参考[[zh_cn:tutorial:loader04x#nested_jars|使用嵌套 JAR 的指引]]。每一项都是包含 ''file'' 键的对象,这个键应该是你的模组 JAR 到嵌套 JAR 的路径。例如:<code json> 
-"jars": [ 
-   { 
-      "file": "nested/vendor/dependency.jar" 
-   } 
-] 
-</code> 
-   * **languageAdapters** 从使用的语言映射到其接收器(adapter)类完整名称的字典。例如:<code json> 
-"languageAdapters": { 
-   "kotlin": "net.fabricmc.language.kotlin.KotlinAdapter" 
-} 
-</code> 
-   * **mixins** mixin配置文件的列表。每一项都是到你的模组 JAR 内的 mixin 配置文件的路径,或者包含以下字段的对象: 
-      * **config** 你的模组 JAR 内到 mixin 配置文件的路径。 
-      * **environment** 与上层 **environment** 字段相同。见上。如:<code json> 
-"mixins": [ 
-   "modid.mixins.json", 
-   { 
-      "config": "modid.client-mixins.json", 
-      "environment": "client" 
-   } 
-] 
-</code> 
- 
-==== 依赖解析 ==== 
-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 "OR" relationship is assumed - that is, only one range has to match for the collective range to be satisfied. 
- 
-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: ''irc://irc.esper.net:6667/charset'' for ''#charset'' at EsperNet - the port is optional, and assumed to be 6667 if not present. 
-      * **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**, **slack**, **twitter**, etc) - if possible, they should be valid URLs. 
-   * **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's contact information. The same as upper level **contact**. See above. Optional. 
-   * **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, etc. of the mod package as a whole. 
-      * For cases where a part of code is dual-licensed, choose the preferred license. The list is not exhaustive, serves primarily as a kind of hint, and does not prevent you from granting additional rights/licenses on a case-by-case basis. 
-      * To aid automated tools, it is recommended to use [[https://spdx.org/licenses/|SPDX License Identifiers]] for open-source licenses. 
-   * **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 ''custom'' field. Loader would ignore them. However //it's highly recommended to namespace your fields// to avoid conflicts if your fields (names) would be added to the standard specification. 
zh_cn/documentation/fabric_mod_json.txt · Last modified: 2024/01/02 10:33 by solidblock