format:modjson
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
format:modjson [2019/04/07 16:26] – asie | format:modjson [2019/05/20 14:21] – Rearrangement, clarification, removal of redundant info falseresync | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== fabric.mod.json | + | ====== fabric.mod.json ====== |
- | In all cases, the mod JSON, '' | + | ===== Mandatory fields ===== |
- | | + | * **schemaVersion** Needed for internal mechanisms. Must always be '' |
- | * or an array containing such objects (this is not supported by Loader as of 0.4.0, but is a part of the specification). | + | * **id** Defines |
+ | | ||
- | If a " | + | ===== Optional fields ===== |
- | It is important to remember that the Fabric mod JSON is **authoritative**. This means that Loader relies on it specifically to gather the necessary information - from the perspective of an external tool, its contents can be trusted and relied upon. | + | ==== Mod loading ==== |
- | ===== Version 1 (current) ===== | + | * **environment**: |
+ | * **'' | ||
+ | * **client** Runs on the client side. | ||
+ | * **server** Runs on the server side. | ||
+ | * **entrypoints** Defines main classes of your mod, that will be loaded. | ||
+ | * There are 3 entry points for your mod: | ||
+ | * **main** Will be run first. For classes implementing '' | ||
+ | * **client** Will be run second and only on the client side. For classes implementing '' | ||
+ | * **server** Will be run second and only on the server side. For classes implementing '' | ||
+ | * Each entry point can contain any number of classes to load. Classes (or methods or static fields) could be defined in two ways: | ||
+ | * If you're using Java, then just list the classes (or else) full names. For example: <code json> | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | </ | ||
+ | * If you're using any other language, that is compatible with Java and has a Fabric adapter, then you should use following syntax: <code json> | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | </ | ||
+ | * **jars** A list of nested JARs inside your mod's JAR to load. Before using the field, check out [[tutorial: | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | </ | ||
+ | * **languageAdapters** A dictionary of adapters for used languages to their adapter classes full names. For example: <code json> | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | * **mixins** A list of mixin configuration files. Each entry is the path to the mixin configuration file inside your mod's JAR or an object containing following fields: | ||
+ | * **config** The path to the mixin configuration file inside your mod's JAR. | ||
+ | * **environment** The same as upper level **environment** field. See above. For example: <code json> | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | </ | ||
- | **Pertains to Loader 0.4.0 and above.** | + | ==== Dependency resolution ==== |
- | ==== Types ==== | + | * **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. | ||
- | === ContactInformation | + | ==== Metadata ==== |
- | A string->string | + | * **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 | ||
+ | * **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. | ||
- | The following keys are officially defined: | + | ===== Custom 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**: | + | |
- | * **issues**: Project issue tracker. Must be a valid HTTP/HTTPS address. | + | |
- | * **sources**: | + | |
- | There are no mandatory keys. | + | You can add any field you want to add. Loader would ignore them. However |
- | + | ||
- | The list is not exhaustive - mods may provide additional, non-standard keys (such as **discord**, | + | |
- | + | ||
- | === EntrypointContainer === | + | |
- | + | ||
- | An EntrypointContainer is an object. | + | |
- | + | ||
- | The keys match the getEntrypoints() " | + | |
- | + | ||
- | * " | + | |
- | * " | + | |
- | * " | + | |
- | * " | + | |
- | + | ||
- | Fabric, by default, will run all " | + | |
- | + | ||
- | === NestedJarEntry === | + | |
- | + | ||
- | An object with the following keys, of which only " | + | |
- | + | ||
- | * " | + | |
- | + | ||
- | === Person === | + | |
- | + | ||
- | Can be in one of two forms: | + | |
- | + | ||
- | * a string (assumed to resolve to a " | + | |
- | * 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. | + | |
- | + | ||
- | === VersionRange === | + | |
- | + | ||
- | A string or array of string declaring supported version ranges. In the case of an array, an " | + | |
- | + | ||
- | In the case of all versions, '' | + | |
- | + | ||
- | For semantic versions, the specification follows a rough subset of the [[https://docs.npmjs.com/ | + | |
- | + | ||
- | * '' | + | |
- | * Version ranges - a set of space-delimited comparators of the ''> | + | |
- | * X-Ranges, | + | |
- | * Tilde Ranges, | + | |
- | * Caret Ranges. | + | |
- | + | ||
- | ==== Mandatory | + | |
- | + | ||
- | * **id**: Contains the mod identifier - a string value matching the '' | + | |
- | * **version**: | + | |
- | + | ||
- | ==== Optional fields (mod loading) ==== | + | |
- | + | ||
- | * **environment**: | + | |
- | * " | + | |
- | * " | + | |
- | * " | + | |
- | * **entrypoints**: | + | |
- | * **jars**: Contains an array of NestedJarEntry objects. If not present, assume empty object. | + | |
- | * **languageAdapters**: | + | |
- | * **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 " | + | |
- | + | ||
- | ==== Optional fields (dependency resolution) ==== | + | |
- | + | ||
- | All of the following keys follow the format of a string-> | + | |
- | + | ||
- | * **depends**: | + | |
- | * **recommends**: | + | |
- | * **suggests**: | + | |
- | * **conflicts**: for these dependencies, | + | |
- | * **breaks**: for these dependencies, | + | |
- | + | ||
- | ==== Optional | + | |
- | + | ||
- | * **name**: Contains the user-facing mod name - a string value. If not present, assume it matches **id**. | + | |
- | * **description**: | + | |
- | * **authors**: | + | |
- | * **contributors**: | + | |
- | * **contact**: | + | |
- | * **license**: | + | |
- | * This should provide the complete set of preferred licenses conveying the entire mod package. In other words, compliance with all listed licenses should | + | |
- | * For cases where a part of code is dual-licensed, | + | |
- | * To aid automated tools, it is recommended | + | |
- | * **icon**: Contains | + | |
- | * A string, providing the path (from the mod's root) to a single .PNG file, | + | |
- | * A string-> | + | |
- | + | ||
- | ==== Custom fields ==== | + | |
- | + | ||
- | 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. | + | |
- | + | ||
- | ===== Version 0 ===== | + | |
- | + | ||
- | This version is utilized if the " | + | |
- | + | ||
- | //TODO: Document me!// | + |