Attempts to get the IModBehaviour of the mod with the given unique name, returns null if the mod couldn’t be found.
MyCoolMod.cs
public class MyCoolMod : ModBehaviour { public void Start() { var newHorizons = ModHelper.Interaction.TryGetMod("xen.NewHorizons"); ModHelper.Console.WriteLine($"New Horizons' version is: {newHorizons?.ModHelper?.Manifest?.Version ?? "NOT INSTALLED"}!"); }}
Attempts to get the API for the mod with the given unique name. You must define the mod’s API as an interface and pass that in as the T. Returns null if the API couldn’t be loaded. To learn how to create and consume APIs, check out the API tutorial.
MyCoolMod.cs
public class MyCoolMod : ModBehaviour { public void Start() { // INewHorizons is assumed to be defined somewhere else var newHorizonsApi = ModHelper.Interaction.TryGetModApi<INewHorizons>(); if (newHorizonsApi != null) { newHorizonsApi.LoadConfigs(this); } }}
Checks if a mod with the given uniqueName is installed and enabled.
MyCoolMod.cs
public class MyCoolMod : ModBehaviour { public void Start() { var timeSaverOn = ModHelper.Interaction.ModExists("Bwc9876.TimeSaver"); ModHelper.Console.WriteLine(timeSaverOn ? "Thank you for using TimeSaver ::)" : "No TimeSaver ::(", timeSaverOn? MessageType.Success : MessageType.Fatal); }}