Normal Java "Project"

Example on how this method of writing addons work.

Simple Example Project

In IntelliJ IDEA, create a new Gradle project by selecting the Gradle Kotlin DSL option.

Intellij IDEA's New Project window

Next, replace the contents of build.gradle.kts with the following:

build.gradle.kts
plugins {
    id("java")
}

group = "my.packagename"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://reposilite.crunchservices.xyz/releases")
}

dependencies {
    compileOnly("com.neonclient:addons-api:1.9")
}

java {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

Next, create a new Java class named CustomAddon under src/main/java/my/packagename, and paste the following content into it:

CustomAddon.java
package my.packagename;

import com.neonclient.api.INeon;
import com.neonclient.api.addon.AbstractNeonAddon;
import com.neonclient.api.addon.event.types.*;

public class CustomAddon extends AbstractNeonAddon {

    public CustomAddon(INeon neon) {
        super("Custom Addon", "Example Author", "A custom addon", neon);
    }

    // this makes the player float while also spoofing it's ground state
    // also print the client's username in chat
    @Override
    public void onPlayerMotionEvent(NeonPlayerMotionEvent event) {
        if (!event.isPre()) return;

        event.setOnGround(true);
        mc.thePlayer.motionY = 0.0;

        getNeon().logChat(getNeon().getUsername());
    }

}

The project structure should look similar to this:

To build a JAR file from the project, click the Gradle icon on the right side of IntelliJ IDEA and run the assemble task.

Last updated