This is an example mod for the AOH3 Fabric Loader. You can use it as a template to create your own mods for this loader. Here are the steps to set it up:
- Initial setup (you need to do it only once)
-
Create a directory where all your mods for AOH3 Fabric Loader will be located.
-
Create a
libs
directory there. -
Download this archive and unzip it's content to previously created
libs
directory. -
Add Fabric Loader's jar to this directory
-
If you are using Windows:
- Copy
game.jar
file from game directory to yourlibs
directory ahd rename it toaoh3.jar
If you are using Mac:
- Go to the game directory, copy
Age of History 3.app/Contents/MacOS/Age of History 3-*Version*.jar
file to yourlibs
directory ahd rename it toaoh3.jar
When a new game update is out you will need to repeat this step.
- Copy
-
Download
aoh3-fabric-api.jar
andaoh3-fabric-api-sources.jar
from a latest AOH3 Fabric Api release and also put them to thelibs
directory. Technically, this is not necessary, but AOH3 Fabric Api provides some very useful utils so why not use them. If there is a new AOH3 Fabric Api version out you also need to repeat this step. -
Optional: For game's code better readability and better navigation of it in the IDE we recommend to decompile it using a decompiler (for example, Vineflower) and attach generated sources to the game's jar in IDE.
- Mod project setup (you need do it for every new mod)
- Clone this repository to the mods projects directory you previously created.
- Rename created directory to your mod's name and also change it in
settings.gradle.kts
file. - Open created project in your favorite IDE (if you don't know what IDE to use we recommend free Intellij IDEA Community Edition).
- Rename
com.example.mod
insrc/main/java
to any namespace you prefer and change it insrc/main/resources/modid.mixins.json
file. - Configure
id
,version
,name
,description
andauthors
fields insrc/main/resources/fabric.mod.json
. Also, replacemodid
in the name ofmodid.mixins.json
file with id of your mod and update it inmixins
field infabric.mod.json
file. - Congratulations! You have successfully set up the mod project.
Now you can start writing mixins. We recommend to install the
Minecraft Dev plugin if you are using IntelliJ IDEA,
it will help with writing of mixins. To build the project use
gradlew build
command, it will create your mod's jar-file inbuild/libs
directory. Also, take a look at Mixins section on Fabric wiki and MixinExtras docs or just watch some videos on YouTube. If you want a deep understanding of this technology you can view the documentation of Mixin library.