Skip to content

Addon quickstart

Choose the Minecraft/loader line in the version matrix. These examples describe this checkout; remote artifact availability has not been verified.

First publish the matching root module locally. Add mavenLocal() alongside the repositories already required by your addon.

Forge 1.20.1:

dependencies {
compileOnly "me.myogoo:myotus:15.1.0:api"
runtimeOnly fg.deobf("me.myogoo:myotus:15.1.0")
}

NeoForge 1.21.1:

dependencies {
compileOnly "me.myogoo:myotus:19.1.1:api"
runtimeOnly "me.myogoo:myotus:19.1.1"
}

The api classifier is a mapped compile artifact, not a runtime mod. Keep the normal unclassified JAR in the development runtime. Configure the matching AE2 dependency in your addon when using AE2 types; these snippets are not complete loader build scripts.

The standalone build has its own settings and build script. Its generated Maven publication uses me.myogoo:myotus:26.1.0 from the configured group, project name, and version. Run publishToMavenLocal with its wrapper and Java 25 from that directory, then use:

dependencies {
compileOnly "me.myogoo:myotus:26.1.0:api"
runtimeOnly "me.myogoo:myotus:26.1.0"
}

As a local-build alternative, copy the normal JAR and -api.jar from build/libs into your addon’s libs directory:

dependencies {
compileOnly files("libs/Myotus-26.1.2-26.1.0-api.jar")
runtimeOnly files("libs/Myotus-26.1.2-26.1.0.jar")
}

File dependencies have no transitive metadata: configure AE2 and any integration dependencies separately. Check generated filenames if you change mod_version. A generated/local Maven publication does not establish remote availability.

Replace examplemod with your addon ID. These ranges are examples bounded to the corresponding Myotus major line; use the minimum version that actually supplies the API your addon uses.

Forge META-INF/mods.toml:

[[dependencies.examplemod]]
modId = "myotus"
mandatory = true
versionRange = "[15.1.0,16)"
ordering = "AFTER"
side = "BOTH"

NeoForge META-INF/neoforge.mods.toml:

[[dependencies.examplemod]]
modId = "myotus"
type = "required"
versionRange = "[19.1.1,20)"
ordering = "AFTER"
side = "BOTH"

For current 26.1.2 source, use [26.1.0,27) instead. A Myotus integration annotation does not replace this loader dependency.

Call this from your addon’s normal setup after Myotus initialization, not a static initializer:

import me.myogoo.myotus.api.MyotusAPI;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
MyotusAPI.creativeTabs()
.registerCreativeTabItem(() -> Items.REDSTONE)
.registerCreativeTabStack(() -> new ItemStack(Items.DIAMOND));

Use your own registered item suppliers in a real addon. Suppliers are evaluated when the creative tab is populated; they must not return null. Register each contribution once.

For a required dependency, calling get() after the proper lifecycle boundary exposes initialization mistakes. For optional access, tryGet() returns Optional<IMyotusAPI>; an empty result does not schedule a retry and does not make referencing an absent Myotus class safe.