Setting up your project¶
BankSystem and StockMarket are Architectury mods for Minecraft 1.21.1 and Java 21. Your mod compiles against their common module and declares them as dependencies, so players install them next to your mod. You never bundle them into your jar.
Both mods need ModUtilities, and StockMarket also needs BankSystem. Add all the mods you use to your build.
The quickest start: the example plugin¶
The StockMarket example plugin is a complete Architectury project for Fabric and NeoForge with a working StockMarket plugin. Copy it, rename the package and the mod id, and you have a project with every setting on this page already done. Your first plugin walks through its code.
Adding the repository¶
The mods are built by JitPack straight from their GitHub tags. Add the repository in every module that uses them (common, fabric, neoforge):
The first build of a new version can take a few minutes while JitPack compiles it. After that it's cached.
Choosing the version¶
Each mod has its own version tag in the form <Minecraft version>-<mod version>, for example 1.21.1-2.2.0. Put the tags into gradle.properties:
Use the versions your players will run. The three mods are released together, so their tags usually match.
Adding the dependencies¶
Common module: compile against the API only.
dependencies {
modCompileOnly("com.github.KROIA.StockMarket:stockmarket-common:$rootProject.stockmarket_tag")
modCompileOnly("com.github.KROIA.BankSystem:banksystem-common:$rootProject.banksystem_tag")
modCompileOnly("com.github.KROIA.MC_ModUtilities:modutilities-common:$rootProject.modutilities_tag")
}
Loader modules: add the full mods, so they run in your development client and server.
dependencies {
modImplementation("com.github.KROIA.StockMarket:stockmarket-fabric:$rootProject.stockmarket_tag")
modImplementation("com.github.KROIA.BankSystem:banksystem-fabric:$rootProject.banksystem_tag")
modImplementation("com.github.KROIA.MC_ModUtilities:modutilities-fabric:$rootProject.modutilities_tag")
}
dependencies {
modImplementation("com.github.KROIA.StockMarket:stockmarket-neoforge:$rootProject.stockmarket_tag")
modImplementation("com.github.KROIA.BankSystem:banksystem-neoforge:$rootProject.banksystem_tag")
modImplementation("com.github.KROIA.MC_ModUtilities:modutilities-neoforge:$rootProject.modutilities_tag")
}
A mod that only uses BankSystem leaves out the StockMarket lines.
The example project also looks for locally built jars first (flatDir). Remove that block if you don't build the mods yourself.
Declaring the dependency¶
Tell the loader that your mod needs StockMarket (or BankSystem), so players get a clear message when it's missing or the wrong version:
The example accepts every 2.2 version. Widen the range only after you've tested your mod with the newer version. For BankSystem, use the mod id banksystem.
Optional integration¶
If your mod also works without the other mod, declare it as optional (Fabric suggests, NeoForge type = "optional"). Then only touch its classes after checking that it's loaded, for example with Architectury's Platform.isModLoaded("stockmarket"), and keep those calls in a separate class. Otherwise your mod crashes when the class can't be found.
Related pages¶
- Developers: which API to use for which job.
- Your first plugin: the example project step by step.
- BankSystem API: the first calls to the bank.