Mod
The Mod class serves as the base class for all mods, containing essential information about your mod, customizable events, and more. All mods inherit from this class.
Allows mods to determine if they can be unloaded at the said moment.
// Mod.CanUnload(System.String@)
public virtual bool CanUnload(ref string message)bool stillLoading = true;
public override bool CanUnload(ref string message)
{
if (stillLoading)
{
message = "The mod is still loading";
return false;
}
return base.CanUnload(ref message);
}Unloads the mod.
// Mod.UnloadMod()
public virtual void UnloadMod()Gets the bytes of an embedded file in the mod.
Returns the bytes of the embedded file, or null if the file doesn't exist.
// Mod.GetEmbeddedFileBytes(System.String)
public virtual byte[] GetEmbeddedFileBytes(string path)byte[] myBundleBytes = GetEmbeddedFileBytes("mybundle.assets");
AssetBundle bundle = AssetBundle.LoadFromMemory(myBundleBytes);Gets the mod information.
Returns the mod information from the modinfo.json file.
Logs a message with the mod name as a prefix.
The WorldEvent_WorldLoaded event triggers on world load complete.
The WorldEvent_WorldSaved event triggers on world save.
The LocalPlayerEvent_Hurt event triggers when the local player takes damage.
The LocalPlayerEvent_Death event triggers when the local player dies.
The LocalPlayerEvent_Respawn event triggers when the local player respawns.
The LocalPlayerEvent_ItemCrafted event triggers when the local player crafts an item.
The LocalPlayerEvent_PickupItem event triggers when the local player picks up a dropped item.
The LocalPlayerEvent_DropItem event triggers when the local player drops an item.
The WorldEvent_OnPlayerConnected event triggers when a player connects to the world.
The WorldEvent_OnPlayerDisconnected event triggers when a player disconnects from the world.
The WorldEvent_WorldUnloaded event triggers on world unload.
The ModEvent_OnModLoaded event triggers when a mod is loaded.
The ModEvent_OnModUnloaded event triggers when a mod is unloaded.
Last updated
Was this helpful?

