Skip to content

Creating your mod

Olafcio1 edited this page Jun 15, 2026 · 3 revisions

Since Avoid supports multiple modloaders, it also has a connected way of creating mods that use its API.
Here's how you can make a mod with it:


1. Setting up your project

(Prerequisites: IntelliJ IDEA)


  1. Create a new Java project in your IDE.
    As the build system, pick Gradle
                                     with the version 9.2.0.

  2. Download the newest Avoid jar for your desired Minecraft version.
    You can do this on Avoid's Modrinth page.

  3. Drag the newest Avoid jar onto a new directory called libs in your IDE into your project root.
    After moving it there, right-click on it and select Add As Library... (Project Library, OK).

  4. Double-click on the build.gradle(.kts) in your project root in your IDE.
    Then, copy the following text and paste it in the place of the dependencies section:


    dependencies {
        testImplementation(platform("org.junit:junit-bom:5.10.0"))
        testImplementation("org.junit.jupiter:junit-jupiter")
        testRuntimeOnly("org.junit.platform:junit-platform-launcher")
        compileOnly(fileTree(rootProject.file("libs")))
    }

  5. Finally, sync your project by clicking the Gradle-sync icon in the top-right corner of your IDE.
    If it doesn't appear, click Shift 3 times, select Actions and search for Sync All.
    Then, click on Sync All Gradle Projects.


2. Creating AvoidLib mod structure


After your project is ready to operate, we still have something left to do.
That is, actually making a mod with the AvoidLib jar in our possesion.

  1. In the src/main/java directory of your project root, create a package, like: com.example.exmod.
    In that package, create a file called ExampleMod.
    Then, paste the following content onto it:

    package com.example.exmod;
    
    import pl.olafcio.avoid.mods.AvoidMod;
    
    public class ExampleMod extends AvoidMod {
        @Override
        public void onEnable() {
            System.out.println("Enabled ExampleMod!");
        }
    }
  2. In the src/main/resources directory of your project root, create a file called avoid.mod.json.
    Then, paste the following content onto it:

    {
      "__schema": 1,
    
      "id": "testmod",
      "version": "1.0",
      "version-system": "semver",
    
      "name": "TestMod",
      "author": "Me",
      "description": "An example mod made with AvoidLib.",
    
      "main-class": "com.example.exmod.ExampleMod"
    }

    In this snippet, however, there are placeholders you need to fill in.
    Replace:

    • the id (testmod) with your mod ID (which is essentially its name without spaces or special characters),
    • the name (TestMod) with your mod name (used for displaying in the GUI and identifying the mod to users),
    • the author (Me) with your nickname,
    • the description (An example mod with AvoidLib.) with your mod description,
    • the main class (com.example.exmod.ExampleMod) with the package name combined with the structure name of your main mod class.

3. Testing your mod

(Prerequisites: IntelliJ IDEA)


Unfortunately, there's not yet a built-in way to test your Avoid mod without adding it to your Minecraft instance.
To do that, however, we need to make a .jar of your Avoid mod - which is called building. Here's how to do it:

  1. Click on the Current File text on the menubar of your IDE:

    image

  2. Click on the Edit Configurations... button in the context menu that opened:

    image

  3. Click on the plus icon in the window that opened:

    image

  4. Select Gradle:

    image

  5. Check Store project file and set the command as build --no-rebuild:

    image

  6. Click OK:

    image

Now, you can build your mod by clicking the new appeared option:

image


Avoid Framework


    🏚️ 1. Home
    📽️ 2. Creating your mod
    🌄 3. Adding assets to your mod
    🧊 4. Creating a block
    ✏️ 5. Creating an item
    🎯 6. Creating an entity selector
    🤖 7. Creating a command

Clone this wiki locally