-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModEntry.cs
54 lines (42 loc) · 1.72 KB
/
ModEntry.cs
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using StardewModdingAPI.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ColoredHoneyLabels
{
internal sealed class ModEntry : Mod
{
#nullable disable
/// <summary>A reference to our mod's instantiation to use everywhere.</summary>
internal static ModEntry Context { get; private set; }
/// <summary>A reference to the Mod's logger so we can use it everywhere.</summary>
internal static IMonitor Logger { get; private set; }
/// <summary>The mod configuration from the player.</summary>
internal static ModConfig Config { get; set; }
#nullable enable
/// <summary>This mod's `UniqueID` from its mod manifest.</summary>
internal static string ModID = null!;
/// <inheritdoc cref="IMod.Entry"/>
public override void Entry(IModHelper helper)
{
Context = this;
Logger = Monitor;
ModID = ModManifest.UniqueID;
// Read user's config and schedule to register our mod and its config options
Config = Helper.ReadConfig<ModConfig>();
Config.ScheduleRegistration();
// Manage our custom asset and modifications to the honey object's definition
Helper.Events.Content.AssetRequested += AssetManager.OnAssetRequested;
Helper.Events.Content.AssetsInvalidated += AssetManager.OnAssetsInvalidated;
Helper.Events.Content.AssetReady += AssetManager.OnAssetReady;
// Reset some things between save games
Helper.Events.GameLoop.ReturnedToTitle += AssetManager.OnReturnedToTitle;
// Apply Harmony patches so that honey items are created as the `ColoredObject` type and get their color assigned to them.
Patches.ApplyPatches();
// Register our custom console commands
ConsoleCommands.AddCommands();
}
}
}