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)

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)

Gets the mod information.

Returns the mod information from the modinfo.json file.

// Mod.GetModInfo()
public JsonModInfo GetModInfo()

Logs a message with the mod name as a prefix.

// Mod.Log(System.Object)
public void Log(object message)

The WorldEvent_WorldLoaded event triggers on world load complete.

// Mod.WorldEvent_WorldLoaded()
public virtual void WorldEvent_WorldLoaded()

The WorldEvent_WorldSaved event triggers on world save.

// Mod.WorldEvent_WorldSaved()
public virtual void WorldEvent_WorldSaved()

The LocalPlayerEvent_Hurt event triggers when the local player takes damage.

// Mod.LocalPlayerEvent_Hurt(System.Single,UnityEngine.Vector3,UnityEngine.Vector3,EntityType)
public virtual void LocalPlayerEvent_Hurt(float damage, Vector3 hitPoint, Vector3 hitNormal, EntityType damageInflictorEntityType)

The LocalPlayerEvent_Death event triggers when the local player dies.

// Mod.LocalPlayerEvent_Death(UnityEngine.Vector3)
public virtual void LocalPlayerEvent_Death(Vector3 deathPosition)

The LocalPlayerEvent_Respawn event triggers when the local player respawns.

// Mod.LocalPlayerEvent_Respawn()
public virtual void LocalPlayerEvent_Respawn()

The LocalPlayerEvent_ItemCrafted event triggers when the local player crafts an item.

// Mod.LocalPlayerEvent_ItemCrafted(Item_Base)
public virtual void LocalPlayerEvent_ItemCrafted(Item_Base item)

The LocalPlayerEvent_PickupItem event triggers when the local player picks up a dropped item.

// Mod.LocalPlayerEvent_PickupItem(PickupItem)
public virtual void LocalPlayerEvent_PickupItem(PickupItem item)

The LocalPlayerEvent_DropItem event triggers when the local player drops an item.

// Mod.LocalPlayerEvent_DropItem(ItemInstance,UnityEngine.Vector3,UnityEngine.Vector3,System.Boolean)
public virtual void LocalPlayerEvent_DropItem(ItemInstance item, Vector3 position, Vector3 direction, bool parentedToRaft)

The WorldEvent_OnPlayerConnected event triggers when a player connects to the world.

// Mod.WorldEvent_OnPlayerConnected(Steamworks.CSteamID,RGD_Settings_Character)
public virtual void WorldEvent_OnPlayerConnected(CSteamID steamid, RGD_Settings_Character characterSettings)

The WorldEvent_OnPlayerDisconnected event triggers when a player disconnects from the world.

// Mod.WorldEvent_OnPlayerDisconnected(Steamworks.CSteamID,DisconnectReason)
public virtual void WorldEvent_OnPlayerDisconnected(CSteamID steamid, DisconnectReason disconnectReason)

The WorldEvent_WorldUnloaded event triggers on world unload.

// Mod.WorldEvent_WorldUnloaded()
public virtual void WorldEvent_WorldUnloaded()

The ModEvent_OnModLoaded event triggers when a mod is loaded.

// Mod.ModEvent_OnModLoaded(HMLLibrary.Mod)
public virtual void ModEvent_OnModLoaded(Mod mod)

The ModEvent_OnModUnloaded event triggers when a mod is unloaded.

// Mod.ModEvent_OnModUnloaded(HMLLibrary.Mod)
public virtual void ModEvent_OnModUnloaded(Mod mod)

Last updated