-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModEntry.cs
More file actions
45 lines (36 loc) · 1.31 KB
/
Copy pathModEntry.cs
File metadata and controls
45 lines (36 loc) · 1.31 KB
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
using HarmonyLib;
using MPF_Code.Config;
using MPF_Code.Farms;
using MPF_Code.Patches;
using StardewModdingAPI;
using StardewModdingAPI.Events;
namespace MPF_Code
{
/// <summary>
/// Main SMAPI entry point for initializing services, config validation, patches, and event hooks.
/// </summary>
internal sealed class ModEntry : Mod
{
public static ModEntry Instance { get; private set; } = null!;
public ModConfig Config { get; set; } = null!;
public override void Entry(IModHelper helper)
{
Instance = this;
Config = helper.ReadConfig<ModConfig>();
ModServices.Init(Monitor, helper);
ConfigBinder.Validate();
var harmony = new Harmony(ModManifest.UniqueID);
PatchRegistrar.ApplyAll(harmony, Config);
helper.Events.GameLoop.GameLaunched += OnGameLaunched;
helper.Events.GameLoop.DayStarted += WorldSetup.OnDayStarted;
helper.Events.GameLoop.OneSecondUpdateTicked += FarmhandNameStamper.OnOneSecondUpdateTicked;
helper.Events.Display.RenderedWorld += MailboxOverlay.OnRenderedWorld;
}
private void OnGameLaunched(object? sender, GameLaunchedEventArgs e)
{
ConfigMenu.Register();
var cp = Helper.ModRegistry.GetApi<ContentPatcher.IContentPatcherAPI>("Pathoschild.ContentPatcher");
CpTokens.RegisterAll(cp!);
}
}
}