The Mod Class
In order to start modding, you need a Mod Class. Requirements for this class are as follows:
- It must extend Mod (
com.wearedevs.someclicker2.core.Mod
) - It must have an the ModInfo annotation (
com.wearedevs.someclicker2.core.annotations.
)
Bare Minimums
Here is an example of a mod that logs the version.
package imdaveead.tutorialmod;
import com.wearedevs.someclicker2.core.Mod;
import com.wearedevs.someclicker2.core.annotations.ModInfo;
@ModInfo(id = "Tutorial", version = TutorialMod.VERSION)
public class TutorialMod extends Mod {
public static final String VERSION = "1.0.0";
// Register ShopItems, Sprites, Sounds, and Events
public void preInit() {
logger.info("Tutorial Mod " + VERSION + " Loaded!");
}
// Make Upgrade Tree, Can Access Other Mod's Items
public void init() {
}
// Handle Stuff Other Mods Want to Do To Your Mod. (You Don't Need to Worry About This)
public void postInit() {
}
}
Notice how I use a field VERSION
to hold the version so I can change it in one place to have it changed in any other place I use it in. I also use logger.info
instead of System.out.println
.