Addons and Customization
DynamX is easily customizable thanks to its addon system, allowing you to add new properties to vehicles, props, and more. Examples are provided, such as keys, sirens, or even a racing system.
Important
Prerequisites: You must add DynamX to your project: instructions here.
Info
More details are provided in the DynamX javadoc, crafted with love in English.
Creating an addon
A DynamX addon can be included in a mod (with an @Mod
annotation), or it can be just an addon without an associated mod.
Info
If your addon is also a mod, remember to add dependencies = "before: dynamxmod"
in your @Mod
annotation.
To make your addon detectable, its main class must have the @DynamXAddon
annotation (which can be combined with the @Mod
annotation). You must then implement a public static function returning void
, annotated with @DynamXAddon.AddonEventSubscriber
. Its name can be anything.
Example
@Mod(modid = HelloWorldAddon.ID, name = "DynamX HelloWorld Addon", version = "1.0.0", dependencies = "before: dynamxmod")
@DynamXAddon(modid = HelloWorldAddon.ID, name = "HelloWorld Addon")
public class HelloWorldAddon
{
public static final String ID = "dynamx_hello_world";
@DynamXAddon.AddonEventSubscriber
public static void init()
{
System.out.println("Hello world!");
}
}
There you go, you have a functional addon! But it doesn't do anything yet...
Adding functions to your addon
Info
You must always register properties and objects in the init function of your addon.
Various tutorials are available on different aspects of DynamX: