First steps
Warning
This page is for the LabyMod 3 Addon API, which is no longer maintained nor supported. Visit https://wiki.labymod.net/pages/addon/ for the LabyMod 4 Addon API Wiki.
First of all you should start by creating a main class and an addon.json file.
The addon.json contains some main information that LabyMod needs to recognize your addon.
These are the attributes you can use in the file:
-
name: this attribute describes the name that will only be used as the config-file's name and the debugging-name
-
uuid: every addon has got an uuid per minecraft version - we recommend to use "%uuid%" as the value because the uuid will be set automatically by us then.
-
mainClass: the main class that is a subclass of "net.labymod.api.LabyModAddon"
-
transformerClass (optional): the transformer class with which you can manipulate the classes' bytecode (We are using Mixin for the latest Minecraft version)
Example of the addon.json
{
"uuid": "%uuid%",
"name": "TestAddon",
"mainClass": "net.labymod.addons.test.TestAddon",
"transformerClass": "net.labymod.addons.test.TestTransformer"
}
Create main class
The main class contains methods that are called at certain events, e.g. onEnable(), onDisable() or loadConfig(). Just make sure to create a subclass of "net.labymod.api.LabyModAddon".
Example
package net.labymod.addons.test;
import net.labymod.api.LabyModAddon;
import net.labymod.settings.elements.SettingsElement;
import java.util.List;
/**
* Test addon
*/
public class TestAddon extends LabyModAddon {
/**
* Called when the addon gets enabled
*/
@Override
public void onEnable() {
}
/**
* Called when the addon gets disabled
*/
@Override
public void onDisable() {
}
/**
* Called when this addon's config was loaded and is ready to use
*/
@Override
public void loadConfig() {
}
/**
* Called when the addon's ingame settings should be filled
*
* @param subSettings a list containing the addon's settings' elements
*/
@Override
protected void fillSettings( List<SettingsElement> subSettings ) {
}
}