Creating the Addon - Randores/Randores2 GitHub Wiki
After you've included Randores in your project, you must create the addon class
. Randores addons must implement RandoresPlugin
, and it is suggested that they extend AbstractRandoresPlugin
:
public class MyAddon extends AbstractRandoresPlugin {
}
This addon class can be separate from your Mod class, or it can be the same class. If you want Randores to be a soft dependency (i.e. your mod can load without it), you should probably have the addon class separate.
After you've created the addon class, you have to register it. To do this, you need a public static
method that returns a RandoresPlugin
(or a subclass of it), as well as the RandoresAddon
and RandoresAddonProvider
annotations. This RandoresAddon
annotation marks classes which have methods annotated by RandoresAddonProvider
. Each method annotated with RandoresAddonProvider
is used to get and register an addon.
@RandoresAddon
public class MyAddon extends AbstractRandoresPlugin {
@RandoresAddonProvider
public static MyAddon createAddon() {
return new MyAddon();
}
}
In the addon provider method you can either create a new instance (as seen above), or return an instance that already exists. If your addon class is the same as your mod class, you'll want to do the latter. An example of this can be seen in the example addon.