public override void Entry(IModHelper helper) { #if DEBUG helper.ConsoleCommands.Add(nameof(HaltEventTime), "", ConsoleCommand); helper.ConsoleCommands.Add("het", "", ConsoleCommand); #endif _instance = this; ModConfig.Instance = Utils.ReadConfig(); helper.Events.GameLoop.UpdateTicked += OnUpdateTicked; helper.Events.Multiplayer.ModMessageReceived += OnModMessageReceived; helper.Events.Multiplayer.PeerContextReceived += OnPeerContextReceived; helper.Events.GameLoop.DayStarted += (sender, e) => { if (!Context.IsMainPlayer) { Active = true; } }; //会在每天和进入服务器时触发 var harmony = new Harmony(nameof(BuffUpdatePatch)); harmony.PatchAll(); }
public override void Entry(IModHelper helper) { #if DEBUG helper.ConsoleCommands.Add(nameof(HaltEventTime), "", ConsoleCommand); helper.ConsoleCommands.Add("het", "", ConsoleCommand); #endif _instance = this; ModConfig.Instance = Utils.ReadConfig(); helper.Events.GameLoop.UpdateTicked += OnUpdateTicked; helper.Events.Multiplayer.ModMessageReceived += OnModMessageReceived; helper.Events.Multiplayer.PeerContextReceived += OnPeerContextReceived; helper.Events.GameLoop.DayStarted += (sender, e) => { if (!Context.IsMainPlayer) { Active = true; } }; //会在每天和进入服务器时触发 #if HARMONY_2 var harmony = new Harmony(nameof(BuffUpdatePatch)); harmony.PatchAll(); #else HarmonyInstance harmony = HarmonyInstance.Create("StardewValley"); harmony.Patch(typeof(Buff).GetMethod("update"), new HarmonyMethod(typeof(BuffUpdatePatch).GetMethod(nameof(BuffUpdatePatch.Prefix)))); #endif }