Skip to content

Latest commit

 

History

History
98 lines (72 loc) · 2.21 KB

File metadata and controls

98 lines (72 loc) · 2.21 KB
title 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.

Adding Controlify dependency

In your build.gradle (or build.gradle.kts), you need to add the maven repository and the Controlify mod dependency.

Maven repository
repositories {
    exclusiveContent {
        forRepository { maven { url "https://maven.isxander.dev/releases" } }
        filter { includeGroup "dev.isxander" }
    }
}
Dependency

Add the version to your gradle.properties:

# You can find the versions in here: https://maven.isxander.dev/#/releases/dev/isxander/controlify
controlify_version=2.4.3+1.21.1-neoforge
dependencies {
    // You can change "compileOnly" to "implementation" for testing in-game.
    compileOnly("dev.isxander:controlify:${project.controlify_version}") {
        // Only need Controlify API, ignore the transitive dependencies (e.g, QuiltMC parsers)
        transitive = false
    }
}

Registering the entrypoint

The entrypoint can be registered using a Java service provider interface (SPI) in META-INF/services/dev.isxander.controlify.api.entrypoint.ControlifyEntrypoint

com.example.mymod.ControlifyEntrypoint

Fabric Entrypoint

On Fabric, the same entrypoint may also be registered via fabric.mod.json.

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

Then simply create the class and implement the interface:

public class ControlifyEntrypoint implements ControlifyEntrypoint {
    @Override
    public void onControlifyPreInit(PreInitContext ctx) {
        // ...
    }

    @Override
    public void onControlifyInit(InitContext ctx) {

    }

    @Override
    public void onControllersDiscovered(ControlifyApi controlify) {
        // ...
    }
}

Using the entrypoint

Use intellisense to see the methods available in each of the init contexts.

Such things include registering custom bindings, button guides, and more.