-
Notifications
You must be signed in to change notification settings - Fork 36
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 ___Subscribers. 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 happen as the name suggests, 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 your mod is used.

The initialize method will be called by ModTheSpire when the game is launched, because of the @SpireInitializer annotation attached to the class. This will then create a new instance of the class, calling the constructor right below. The constructor of the class subscribes the instance to BaseMod, which will call the previously mentioned subscriber methods.
Currently, this main mod file doesn't do very much. Feel free to read through the comments before continuing.