frogmc.dev/spec/fmt.md
2024-06-10 19:39:12 -05:00

88 lines
4.7 KiB
Markdown

# frog.mod.toml Specification
**frog.mod.toml** is a file containing metadata related to your mod in frog. It is quite similar to the metadata formats of other mod loaders, however it is reorganized to be less cluttered. It is in the [TOML](https://toml.io/) format, and this document will use the grammar of that format.
#### `[frog]`
The `[frog]` table contains information about this metadata file.
- `format_version`: the format version of this frog.mod.toml file. The current format version is 1.0.0.
#### `[frog.mod]`
The `[frog.mod]` table contains information about your mod.
- `id`: your mods namespace id. Should be alphanumeric without spaces, and all lowercase.
- `name`: the formatted name of your mod. Optional but strongly recommended.
- `version`: the version of your mod. Should respect the [SemVer](https://semver.org/) specification.
- `license`: the license of your mod. Should be either an [SPDX License Identifier](https://spdx.org/licenses/) or a hyperlink to your license. Optional but recommended.
- `credits`: the credits of your mod. Should be made up of [Person](#Person) inline tables. Optional but recommended.
##### Person
The Person inline table identifies someone associated with your mod. It contains the following fields:
- `name`: The name of the person. Can be any string.
- `roles`: The roles of the person in the project. Should be an array of strings. <!---TODO: translatable roles in mod menu-->
#### `[frog.dependencies]`
The `[frog.dependencies]` table contains information about this mod's dependencies, as well as mod incompatibilities. `depends`, `breaks`, `suggests`, and `provides` are all arrays of [Mod](#Mod) inline tables.
##### Mod
The Mod inline table contains information referencing a mod other than your own. It contains the following fields:
- `id`: the other mods namespace id. Should be alphanumeric without spaces and all lowercase, unless the source mod isn't.
- `versions`: the range of versions of the other mod that your mod requires. Should be a SemVer version, or a range of SemVer versions (see [this](https://github.com/npm/node-semver#ranges) for a more detailed specification on SemVer ranges). If any version is acceptable, can also be set to `*`. **Use only in `depends`, `breaks`, and `suggests` arrays!**
- `version`: a single version of another mod. Should be a SemVer version. **Use only in `provides` array!**
- `name`: the formatted name of the required mod. Optional.
- `link`: a link to the download page of the mod. Mods from certain sites may be able to be handled specially by frog loader. Optional.
#### `[frog.extensions]`
The `[frog.extensions]` table contains information on definitions that modify the behavior of the loader or game. It can contain the following fields:
- `mixin`: reference to a `.mixins.json` file contained within the `src/resources` folder. See [Mixin](/exts/mixin).
- `accesswidener`: reference to a `.accesswidener` file contained within the `src/resources` folder. See [AccessWidener](/exts/aw).
- `prelaunch`: reference to a PreLaunch class on the classpath, separated by forward slashes. See [PreLaunch](/exts/prelaunch).
- `init`: reference to a MainExtension entrypoint on the classpath, separated by forward slashes. See [MainExtension](/exts/entrypoints#MainExtension).
- `client`: reference to a ClientExtension entrypoint on the classpath, separated by forward slashes. See [ClientExtension](/exts/entrypoints#ClientExtension).
- `server`: reference to a ServerExtension entrypoint on the classpath, separated by forward slashes. See [ServerExtension](/exts/entrypoints#ServerExtension).
#### Internal Keys
The `included_jars` and `phytotelma.generated` keys are inserted by the [Phytotelma](/contributing/tools#phytotelma) tool and should not be edited manually.
### Full Example
The following is an example of a complete well-formated frog.mod.toml file.
```toml
[frog]
format_version = "1.0.0"
[frog.mod]
id = "example_mod"
name = "Example Mod"
version = "1.0.0"
license = "CC0-1.0"
credits = [
{ name = "You", roles = ["author", "other_role"] }
]
[frog.dependencies]
depends = [
{ id = "other_mod", versions = ">=0.2.0", name = "Other Mod", link = "https://modrinth.com/mod/<slug>" }
]
breaks = [
{ id = "old_mod", versions = "*" }
]
suggests = [
{ id = "frogloader", versions = "*" }
]
provides = [
{ id = "provided_mod", version = "2.0.0" }
]
[frog.extensions]
mixin = "example_mod.mixins.json"
accesswidener = "example_mod.accesswidener"
prelaunch = "com/example/frog/PreLaunch"
init = "com/example/frog/FrogInit"
client = "com/example/frog/client/FrogClientInit"
server = "com/example/frog/server/FrogServerInit"
included_jars = [
{ id = "mod_id", path = "META-INF/jars/mod.jar" }
]
phytotelma.generated = true
```