-
Notifications
You must be signed in to change notification settings - Fork 22
The Main Mod File
The main file of your mod is where all of its content is actually added to the game.
You can tell which class it is by the @SpireInitializer
annotation placed at the top of the file. (Annotation is the word used for marks that start with @
in code)
At the top of the file you can see that the class implements
various ___Subscriber
s. These subscribers are each linked to individual methods which will by called by BaseMod at specific times. For example, the PostInitializeSubscriber
defines the receivePostInitialize
method, which will be called by BaseMod after the game is initialized. For a full list of these, you can see the BaseMod wiki.
A bit further down is the first thing that will happen when the game is started with your mod enabled.
When the game is launched, ModTheSpire
calls the initialize
method of any classes with the @SpireInitializer
annotation. This will then create a new instance of the class, calling the constructor. The constructor of the class subscribes to BaseMod, which is what enables the previously mentioned subscriber methods.
Currently, this main mod file doesn't do very much. Feel free to read through the comments before continuing.