summaryrefslogtreecommitdiff
path: root/src/SMAPI/IMod.cs
blob: 87c9880cc7b3ccc3508701c37d751af17f62a1d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
namespace StardewModdingAPI
{
    /// <summary>The implementation for a Stardew Valley mod.</summary>
    public interface IMod
    {
        /*********
        ** Accessors
        *********/
        /// <summary>Provides simplified APIs for writing mods.</summary>
        IModHelper Helper { get; }

        /// <summary>Writes messages to the console and log file.</summary>
        IMonitor Monitor { get; }

        /// <summary>The mod's manifest.</summary>
        IManifest ModManifest { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        void Entry(IModHelper helper);

        /// <summary>Get an <a href="https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Integrations">API that other mods can access</a>. This is always called after <see cref="Entry"/>, and is only called once even if multiple mods access it.</summary>
        /// <remarks>You can implement <see cref="GetApi()"/> to provide one instance to all mods, or <see cref="GetApi(IModInfo)"/> to provide a separate instance per mod. These are mutually exclusive, so you can only implement one of them.</remarks>
        /// <remarks>Returns the API instance, or <c>null</c> if the mod has no API.</remarks>
        object? GetApi();

        /// <summary>Get an <a href="https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Integrations">API that other mods can access</a>. This is always called after <see cref="Entry"/>, and is called once per mod that accesses the API (even if they access it multiple times).</summary>
        /// <param name="mod">The mod accessing the API.</param>
        /// <remarks>Returns the API instance, or <c>null</c> if the mod has no API. Note that <paramref name="mod"/> is provided for informational purposes only, and that denying API access to specific mods is strongly discouraged and may be considered abusive.</remarks>
        /// <inheritdoc cref="GetApi()" include="/Remarks" />
        object? GetApi(IModInfo mod);
    }
}