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

Both sides previous revisionPrevious revision
Next revision
Previous revision
zh_cn:documentation:fabric_mod_json [2021/09/01 08:12] – [依赖解析] solidblockzh_cn:documentation:fabric_mod_json [2024/01/02 10:33] (current) – ↷ Page name changed from zh_cn:documentation:fabric_mod_json_spec to zh_cn:documentation:fabric_mod_json solidblock
Line 5: Line 5:
  
    * **schemaVersion** 用于内部机制。总是为 ''1''    * **schemaVersion** 用于内部机制。总是为 ''1''
-   * **id** 定义模组的 id——由字母、数字、下划线组成的字符串,长度为 1 到 63+   * **id** 定义模组的 id——由字母、数字、下划线组成的字符串,长度为 1 到 63。
    * **version** 定义模组版本——字符串值,建议符合 [[https://semver.org/|Semantic Versioning 2.0.0]] 的规定。    * **version** 定义模组版本——字符串值,建议符合 [[https://semver.org/|Semantic Versioning 2.0.0]] 的规定。
  
Line 12: Line 12:
 ==== 模组加载 ==== ==== 模组加载 ====
  
 +   * **provides**:定义了提供的模组的 id 的列表,可以看做模组的别称。Fabric Loader 将会认为这些 id 的模组是存在的。如果存在其他使用这个 id 的模组,这些模组会直接不加载。
    * **environment**:定义了模组在哪里运行:只在客户端(客户端模组),或只在服务端(插件),或二者(常规模组)。包含环境标识符:    * **environment**:定义了模组在哪里运行:只在客户端(客户端模组),或只在服务端(插件),或二者(常规模组)。包含环境标识符:
-      * **''*''** 运行在客户端与服务。默认。+      * **''*''** 运行在客户端与服务。默认。
       * **client** 运行在客户端。       * **client** 运行在客户端。
-      * **server** 运行在服务+      * **server** 运行在服务
    * **entrypoints** 定义了你的模组的要加载的主要的类。    * **entrypoints** 定义了你的模组的要加载的主要的类。
       * 你的模组有三种默认的入口点:       * 你的模组有三种默认的入口点:
          * **main** 会先运行。用于实现了 ''ModInitializer'' 的类。          * **main** 会先运行。用于实现了 ''ModInitializer'' 的类。
          * **client** 仅在客户端,会随后运行。用于实现了 ''ClientModInitializer'' 的类。          * **client** 仅在客户端,会随后运行。用于实现了 ''ClientModInitializer'' 的类。
-         * **server** 仅在服务端,会随后运行。用于实现了 ''DedicatedServerModInitializer''+         * **server** 仅在服务端,会随后运行。用于实现了 ''DedicatedServerModInitializer'' 的类
       * 每个入口点都可以包含多个需要加载的模组。类(或者方法,或者静态字段)可以用两种方式定义:       * 每个入口点都可以包含多个需要加载的模组。类(或者方法,或者静态字段)可以用两种方式定义:
          * 如果使用Java,列举类(或者其他)的完整名称。例如:<code json>          * 如果使用Java,列举类(或者其他)的完整名称。例如:<code json>
Line 30: Line 31:
    * 如果你使用其他语言,参考该语言的文档。Kotlin 的位于 [[https://github.com/FabricMC/fabric-language-kotlin/blob/master/README.md|此网站]]。    * 如果你使用其他语言,参考该语言的文档。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** 你的模组 JAR 中需要加载的嵌套 JAR。使用此字段前,请参考[[zh_cn:tutorial:loader04x#嵌套 JAR|使用嵌套 JAR 的指引]]。每一项都是包含 ''file'' 键的对象,这个键应该是你的模组 JAR 到嵌套 JAR 的路径。例如:<code json>
 "jars": [ "jars": [
    {    {
Line 68: Line 69:
 ==== 元数据 ==== ==== 元数据 ====
  
-   * **name** Defines the user-friendly mod's name. If not present, assume it matches **id**. +   * **name** 定义用于易读的模组名称。如果不存在,则假定符合 **id** 
-   * **description** Defines the mod's description. If not present, assume empty string. +   * **description** 定义模组的描述。如果不存在,则假定为空字符串。 
-   * **contact** Defines the contact information for the project. It is an object of the following fields: +   * **contact** 定义项目的联系信息,此对象包含以下字段: 
-      * **email** Contact e-mail pertaining to the mod. Must be a valid e-mail address. +      * **email** 通过电邮联系与模组有关事项,必须是有效的电邮地址。 
-      * **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. +      * **irc** 与模组有关的 IRC 频道。必须是有效的 URL 格式,例如:''irc://irc.esper.net:6667/charset'' for ''#charset'' at EsperNet——端口是可选的,如果不存在,假定为6667 
-      * **homepage** Project or user homepage. Must be a valid HTTP/HTTPS address. +      * **homepage** 项目或用户主页,必须是有效的 HTTP/HTTPS 地址。 
-      * **issues** Project issue tracker. Must be a valid HTTP/HTTPS address. +      * **issues** 项目问题追踪器,必须是有效的 HTTP/HTTPS 地址。 
-      * **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). +      * **sources** 项目源代码仓库,必须是有效的 URL——但是也可以是给定的 VCS 的专用 URL(例如 Git 或 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. +      * 本列表并未列举尽——模组也许会提供额外的、非标准的键(例如 **discord****slack****twitter**,等等)——如有可能,一般都需要是有效的 URL。 
-   * **authors** A list of authors of the mod. Each entry is a single name or an object containing following fields: +   * **authors** 模组作者的列表。每一项都是单个名称,或者是包含以下字段的对象: 
-      * **name** The real name, or username, of the person. Mandatory. +      * **name** 真名或用户名,必须。 
-      * **contact** Person's contact information. The same as upper level **contact**. See above. Optional. +      * **contact** 此人的联系信息。与上面的 **contact** 一样,见上。可选。 
-   * **contributors** A list of contributors to the mod. Each entry is the same as in **author** field. See above. +   * **contributors** 模组贡献者的列表。每一项与 **author** 字段格式一致,见上。 
-   * **license** Defines the licensing information. Can either be a single license string or a list of them. +   * **license** 定义许可协议信息。可以是单个协议字符串或者其列表。 
-      * 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.+      * 对于代码有部分受双协议影响的情况,选择受推荐的协议。 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.       * 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: +   * **icon** 定义模组的图标。图标是正方形 PNG 文件。(Minecraft 资源包使用 128×128,但并非硬性要求,但是建议长宽均为 2 的次幂。)可以以两种方式提供: 
-      * A path to a single PNG file. +      * 到单个 PNG 文件的路径。 
-      * 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.+您可以在 ''custom'' 字段中添加任何要添加的字段。Loader 会忽略这些字段。但是//强烈建议为您的字段命名//以避免在将您的字段(名称)添加到标准规范时发生冲突。
zh_cn/documentation/fabric_mod_json.1630483974.txt.gz · Last modified: 2021/09/01 08:12 by solidblock