| title | fabric.mod.json | ||||
|---|---|---|---|---|---|
| description | A guide to the `fabric.mod.json` specification. | ||||
| authors |
|
||||
| authors-nogithub |
|
The fabric.mod.json file is a metadata file used by Fabric Loader to load mods. In order to be loaded, a mod must have this file with the exact name placed in the root directory of the mod JAR.
schemaVersionMust always be1. Required for Fabric Loader to parse the file correctly.idA string value that defines the mod's identifier - allowed characters include Latin letters, digits, underscores, and hyphens, with length from 2 to 64.versionA string value that defines the mod's version, expected to match the Semantic Versioning 2.0.0 specification. The template mod populates this automatically from the version set ingradle.properties.
"schemaVersion": 1,
"id": "example-mod",
"version": "${mod_version}",environment: A string value that defines which environments the mod should be run on:*: Runs in all environments. Default.client: Runs on the physical client side. If set, your mod will not be loaded on dedicated servers.server: Runs on the physical server side. If set, your mod will not be loaded on clients or in singleplayer.
"name": "Example mod",
"description": "This is an example description! Tell everyone what your mod is about!",entrypointsAn object that defines the main classes of your mod. that will be loaded.mainAn array of string class names that implementModInitializer.clientAn array of string class names that implementClientModInitializer. This entrypoint is run aftermainand only on the physical client side.serverAn array of string class names that implementDedicatedServerModInitializer. This entrypoint is run aftermainand only on the physical server side.
Fabric provides three main entrypoints, but other mods may provide their own (i.e. modmenu for Mod Menu entrypoints). 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:
"main": [
"net.fabricmc.example.ExampleMod",
"net.fabricmc.example.ExampleMod::handle"
]If you're using any other language, consult the language adapter's documentation. The Kotlin one can be found on Fabric Language Kotlin's README.
jars: An array of nested JARs inside your mod's JAR to load. When using Loom, usingincludeon your dependencies will automatically populate this. Each entry is an object containingfilekey. That should be a path inside your mod's JAR to the nested JAR. For example:
"jars": [
{
"file": "nested/vendor/dependency.jar"
}
]languageAdapters: A dictionary of adapters for used languages to their adapter classes full names. For example:
"languageAdapters": {
"kotlin": "net.fabricmc.language.kotlin.KotlinAdapter"
}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:
"mixins": [
"modid.mixins.json",
{
"config": "modid.client-mixins.json",
"environment": "client"
}
]provides: An array of mod ids Defines the list of ids of mod. It can be seen as the aliases of the mod. Fabric Loader will treat these ids as mods that exist. If there are other mods using that id, they will not be loaded.
"provides": [
"example_mod"
]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. If any are missing, Fabric Loader will trigger a crash.recommends: For dependencies not required to run. For each missing dependency, Fabric Loader 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. If any are present, Fabric Loader will trigger a crash.conflicts: For mods whose together with yours cause some kind of bugs, etc. For each conflicting mod present, Fabric Loader will log a warning.
"depends": {
"example-mod": "*"
}
"suggests": {
"another-mod": ">1.0.0"
}name: A string that defines the user-friendly mod's name. If not present, assume it matches id.description: A string that defines the mod's description. If not present, assume empty string.
contact: A dictionary that defines the contact information for the project.email: A string that defines the contact e-mail pertaining to the mod. Must be a valid e-mail address.homepage: A string that defines the project or user's homepage. Must be a valid HTTP/HTTPS address.irc: A string that defines the IRC channel pertaining to the mod. Must be of a valid URL format - for example:irc://irc.esper.net:6667/charsetfor#charsetat EsperNet - the port is optional, and assumed to be 6667 if not present.issues: A string that defines the project's issue tracker. Must be a valid HTTP/HTTPS address.sources: A string that defines the project's 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.
"contact": {
"homepage": "https://fabricmc.net",
"sources": "https://github.com/FabricMC/fabric-example-mod"
}authors and contributors are both arrays of strings or objects containing following fields:
-
nameThe real name, or username, of the person. Mandatory. -
contactPerson's contact information. The same as upper level contact. See above. Optional. -
authorsAn array of authors of the mod. -
contributorsAn array of contributors to the mod.
"authors": [
"Me!",
{
"name": "Tiny Potato"
}
]licenseA string or array that defines the licensing information.
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.
"license": "CC0-1.0",iconDefines 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.
"icon": "assets/modid/icon.png",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 with other mods.