Appearance
Project setup
fabric.mod.json
Every addon describes itself in a normal Fabric fabric.mod.json:
json
{
"schemaVersion": 1,
"id": "my-addon",
"version": "${version}",
"name": "My Addon",
"description": "What your addon does, in one sentence.",
"authors": ["You"],
"license": "MIT",
"icon": "assets/my-addon/icon.png",
"environment": "client",
"entrypoints": { "lynx": ["com.example.myaddon.MyAddon"] },
"custom": {
"lynx": {
"api": 1,
"minecraft": ["1.21.1", "26.3"],
"depends": { "other-addon": ">=1.2.0" }
}
}
}| Field | Required | Meaning |
|---|---|---|
id | yes | Unique id, a-z 0-9 - _. In the store it belongs to the account that submits it first. |
entrypoints.lynx | yes | Exactly one class that implements LynxAddon |
custom.lynx.api | yes | API major version the addon was written for, currently 1 |
custom.lynx.minecraft | no | Only these Minecraft versions. Leave it out for all. |
custom.lynx.depends | no | Other addons with a version range (>=1.2.0, 1.x, *) |
name, description, authors, license, icon | no | Shown in the mod menu and the store |
Dependencies on other addons
Use custom.lynx.depends, not Fabric's own depends. If something from Fabric's depends is missing, the whole game refuses to start. With custom.lynx.depends only your addon is switched off, and the mod menu shows why. Addons are loaded in dependency order.
The entry point
java
public final class MyAddon implements LynxAddon {
@Override
public void onLoad(LynxApi lynx) {
lynx.modules().register(new HelloWidget());
}
@Override
public void onShutdown() {
// optional: when the game closes. Module settings are saved by LynxClient.
}
}onLoad runs once at start, after LynxClient's own modules and after the addons yours depends on. If it throws, the addon is marked as failed, the modules it registered are removed again and the game keeps running.
LynxApi gives you:
| Method | |
|---|---|
modules() | Register and look up modules |
events() | The event bus |
game() | Read-only game state |
addons() | All addons found at start, with their state |
version() / minecraftVersion() | LynxClient version, running Minecraft version |
Outside onLoad you can get the same object with Lynx.api().
Gradle
kotlin
plugins { java }
version = "1.0.0"
repositories { maven("https://download.lynxclient.de/maven") }
dependencies { compileOnly("net.lynxclient:lynx-api:0.1.17") }
tasks.withType<JavaCompile>().configureEach {
options.release = 17
options.encoding = "UTF-8"
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") { expand("version" to project.version) }
}Libraries other than the Lynx API cannot be used in store addons yet, because the store builds your addon against the API only.