First steps

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

Example of the addon.json

1
2
3
4
5
6
{
  "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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 ) {

    }

}