User Tools

Site Tools



任何情况下,模组 JSON,即 fabric.mod.json,定义如下:

  • 包含 “schemaVersion” 键,其值为整数值的对象,表示版本格式,或者:
  • 包含这些对象的数组(0.4.0的加载器版本不支持,但是这是规定文档的一部分)。

如果 “schemaVersion” 键不存在,假定其版本为 “0”。

特别要记住,Fabric 模组 JSON 是权威的,也就是说加载器特别依赖该文件以收集必要信息——从外部工具的角度来看,其内容是受信任和被依赖的。

版本 1(当前)

属于加载器 Loader 0.4.0 以上版本。





  • email:属于该模组的联系电邮。必须是有效的电邮地址。
  • irc:属于该模组的 IRC 频道。必须是有效的 URL 格式,例如:irc:// for #charset at EsperNet——端口是可选的,如果不存在,则假定为6667。
  • homepage:项目或用户主页,必须是有效的 HTTP/HTTPS 地址。
  • issues:项目问题追踪器,必须是有效的 HTTP/HTTPS 地址。
  • sources:项目源代码仓库,必须是有效的 URL——但是也可以是给定的 VCS 的专用 URL(例如 Git 或 Mercurial)。


本列表并未列举尽——模组也许会提供额外的、非标准的(例如 discordslacktwitter)——如有可能,一般都需要是有效的 URL。


EntrypointContainer 是个对象。

键需要匹配 getEntrypoints() 的 “type” 字段,且为需要列举的入口点类型——“main”、“client”、“server”,这些键的值为数组,包含以下形式的字符串(对象键 “value” 的值中的)或者对象:

  • “adapter”:包含需要使用的语言接收器,可选。如果为空,默认为 “default”。
  • “value”:默认的语言接收器使用以下专门的键作为字符串值,其格式如下:
    • “my.package.MyClass”,指定需要实例化的类。
    • “my.package.MyClass::thing”,指定命名为 “thing” 的静态类(返回内容)或者方法处理(对于接口类,自动代理)。

默认情况下,Fabric 会运行所有的 “main” 入口点(ModInitializer 类型),然后是所有的 “client”(ClientModInitializer 类型)或“server”(DedicatedServerModInitializer 类型)入口点。


包含以下键的对象,其中仅有 “file” 是必需的。

  • “file” - a string value pointing to a path from the root of the mod to a nested JAR which should be loaded alongside the outer mod JAR.


Can be in one of two forms:

  • a string (assumed to resolve to a “name” key in the object),
  • an object.

In the case of an object, the following keys are defined:

  • name: The real name, or username, of the person. Mandatory.
  • contact An optional ContactInformation object containing contact information pertaining to the person.


A string or array of string 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.

For semantic versions, the specification follows a rough subset of the NPM semver specification, in particular the following features are supported:

  • = as a leading character, or the lack of one, denoting an exact match,
  • Version ranges - a set of space-delimited comparators of the >=, >, , <, = or no prefix, following NPM behaviour and declaring an intersection of supported versions within the scope of the string,
  • X-Ranges,
  • Tilde Ranges,
  • Caret Ranges.


  • id:包含模组标识符,为字符串,需符合 ^[a-z][a-z0-9-_]{1,63}$ 样式,只能有小写字母、数字、-_ 组成,且以字母开头。
  • version:包含模组版本——字符串值,建议符合 Semantic Versioning 2.0.0 的规定。


  • environment: For games with multiple environments - is a string value (or an array of string values) defining the environments the mod should be considered for loading on. Supported values are:
    • “*” - all environments (default),
    • “client” - the game client,
    • “server” - the game dedicated server (integrated servers are not included here).
  • entrypoints: Contains an EntrypointContainer. If not present, assume empty object.
  • jars: Contains an array of NestedJarEntry objects. If not present, assume empty object.
  • languageAdapters: A string→string dictionary, connecting namespaces to LanguageAdapter implementations.
  • mixins: Contains a list of mixin configuration files for the Mixin library as filenames relative to the mod root - an array of (can be mixed):
    • string values,
    • objects containing a “config” key (filename), as well as optional keys of the following types: “environment”.
  • accessWidener: A file path to an access widener relative to the mod root. If not present, assume the mod has no access widener.


All of the following keys follow the format of a string→VersionRange dictionary, where the string key matches the desired ID.

  • depends: for these dependencies, a failure to match causes a hard failure,
  • recommends: for these dependencies, a failure to match causes a soft failure (warning),
  • suggests: these dependencies are not matched and are primarily used as metadata,
  • conflicts: for these dependencies, a successful match causes a soft failure (warning),
  • breaks: for these dependencies, a successful match causes a hard failure.


  • name: Contains the user-facing mod name - a string value. If not present, assume it matches id.
  • description: Contains the user-facing mod description - a string value. If not present, assume empty string.
  • authors: Contains the direct authorship information - an array of Person values.
  • contributors: Contains the contributor information - an array of Person values.
  • contact: Contains the contact information for the project - a ContactInformation object.
  • license: Contains the licensing information - a string value, or an array of string values.
    • 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 SPDX License Identifiers for “open source” licenses.
  • icon: Contains the mod's icon, as a square .PNG file. (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 string, providing the path (from the mod's root) to a single .PNG file,
    • A string→string dictionary, where the keys conform to widths of each PNG file, and the values are said files' paths.


A custom field can be provided in the JSON. It is a dictionary of string keys to JSON elements, and the contents of said JSON elements are entirely arbitrary. The Fabric loader will make no effort to read its contents, aside from a situation in which custom features in older schema versions become official in future schema versions, as a compatibility measure - those will be adequately documented.

It is recommended that the keys be namespaced with the ID of the mod relying on them (if such a mod exists) to prevent conflicts.

版本 0

This version is utilized if the “schemaVersion” field is missing - where it is assumed to be 0. It was used by all Fabric Loader versions prior to 0.4.0. It was inspired by the craftson/spec specification.

TODO: Document me!

zh_cn/documentation/fabric_mod_json_spec.txt · Last modified: 2022/02/25 07:01 by solidblock