Controlify Entrypoint

Learn how to hook into Controlify.

Controlify provides a Fabric entrypoint to hook into important lifecycle stages of Controlify. You do this just like ClientModInitializer.

Registering the entrypoint

To register the entrypoint, you do the same as you would with the main or client entrypoint inside of fabric.mod.json

fabric.mod.json
{
  "entrypoints": {
    "controlify": [
      "com.example.mymod.ControlifyEntrypoint"
    ]
  }
}

Then simply create the class and implement the interface:

ControlifyEntrypoint.java
public class ControlifyEntrypoint implements ControlifyEntrypoint {
    @Override
    public void onControlifyPreInit(ControlifyApi controlify) {
        // ...
    }
    
    @Override
    public void onControllersDiscovered(ControlifyApi controlify) {
        // ...
    }
}

Using the entrypoint

Pre-init method

The onControlifyPreInit method is called once Controlify has initialised some systems but controllers have not yet been discovered and constructed. This is the ideal time to register things such as bindings, button guide, ingame guide, events etc in preparation for controller discovery.

Controllers discovered method

Currently, there are no APIs that require to be called from this method, however any custom code can be called from here now the initial controller discovery has completed.

Last updated