# Controlify Entrypoint

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`

{% code title="fabric.mod.json" %}

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

{% endcode %}

Then simply create the class and implement the interface:

{% code title="ControlifyEntrypoint.java" %}

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

{% endcode %}

## 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](https://docs.isxander.dev/controlify/developers/bindings-api), 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.
