public override void Entry(IModHelper helper) { ModConfig = helper.ReadJsonFile <OmniFarmConfig>("config.json"); if (ModConfig == null) { ModConfig = helper.ReadConfig <OmniFarmConfig>().Default(); helper.WriteConfig <OmniFarmConfig>(ModConfig); } if (ModConfig.useOptionalCave == true) { helper.Content.AssetLoaders.Add(new MyAssetLoader(helper)); } StardewModdingAPI.Events.TimeEvents.AfterDayStarted += AfterDayStarted; }
public override void Entry(IModHelper helper) { ModConfig = helper.ReadJsonFile <OmniFarmConfig>("config.json"); if (ModConfig == null) { ModConfig = helper.ReadConfig <OmniFarmConfig>().Default(); helper.WriteConfig <OmniFarmConfig>(ModConfig); } StardewModdingAPI.Events.TimeEvents.AfterDayStarted += AfterDayStarted; /* * StardewModdingAPI.Events.MineEvents.MineLevelChanged += (q, e) => * { * if (ModConfig == null) * return; * * if ((Game1.currentLocation is MineShaft) == false) * return; * * List<Vector2> grassLocations = new List<Vector2>(); * AddVector2Grid(new Vector2(0, 0), new Vector2(50, 50), ref grassLocations); * foreach (Vector2 tile in grassLocations) * { * StardewValley.Object check; * if (Game1.currentLocation.objects.TryGetValue(tile, out check)) * { * Log.Debug(check.name); * Log.Debug(check.bigCraftable); * Log.Debug(check.isOn); * Log.Debug(check.canBeGrabbed); * Log.Debug(check.canBeSetDown); * Log.Debug(check.parentSheetIndex); * Log.Debug(check.getHealth()); * Log.Debug(check.fragility); * Log.Debug(check.type); * Log.Debug(check.GetType()); * } * } * }; */ }
/********* ** 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> public override void Entry(IModHelper helper) { Config = helper.ReadConfig <OmniFarmConfig>(); helper.Events.GameLoop.DayStarted += OnDayStarted; }