Ejemplo n.º 1
0
        /// <summary>
        /// Called firstly when SMAPI finished loading of the mod.
        /// </summary>
        /// <param name="helper"></param>
        public override void Entry(IModHelper helper)
        {
            // Loads configuration from file.
            Config conf = Helper.ReadConfig <Config>();

            // Initialize InstanceHolder.
            InstanceHolder.Init(this, conf);

            // Initialize Logger
            Logger.Init(this);

            // Register events.
            EventHolder.RegisterEvents(Helper.Events);


            // Registration commands.
            Helper.ConsoleCommands.Add("joedebug", "Debug command for JoE", OnDebugCommand);

            // Limit config values.
            ConfigLimitation.LimitConfigValues();

            // Check mod compatibilities.
            if (ModChecker.IsCoGLoaded(helper))
            {
                Logger.Log("CasksOnGround detected.");
                IsCoGOn = true;
            }

            if (ModChecker.IsCaLoaded(helper))
            {
                Logger.Log("CasksAnywhere detected.");
                IsCaOn = true;
            }

            if (ModChecker.IsCcLoaded(helper))
            {
                Logger.Log("Convenient Chests detected. JoE's CraftingFromChests feature will be disabled and won't patch the game.");
                Conf.CraftingFromChests = false;
                IsCcOn = true;
            }
            else if (!Conf.SafeMode)
            {
                Logger.Log("Start patching using Harmony...");
                HarmonyPatched = HarmonyPatcher.Init();
            }
            else
            {
                Logger.Log("SafeMode enabled, and won't patch the game.");
            }
            helper.WriteConfig(Conf);
            MineIcons.Init(helper);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called firstly when SMAPI finished loading of the mod.
        /// </summary>
        /// <param name="helper"></param>
        public override void Entry(IModHelper helper)
        {
            // Initialize Logger
            Logger.Init(Monitor);

            // Initialize InstanceHolder.
            InstanceHolder.Init(this);

            // Register events.
            EventHolder.RegisterEvents(Helper.Events);


            // Registration commands.
            Helper.ConsoleCommands.Add("joedebug", "Debug command for JoE", OnDebugCommand);
            Helper.ConsoleCommands.Add("joerelcon", "Reloading config command for JoE", OnReloadConfigCommand);


            // Limit config values.
            ConfigLimitation.LimitConfigValues();

            // Check mod compatibilities.
            if (ModChecker.IsCoGLoaded(helper))
            {
                Logger.Log("CasksOnGround detected.");
                IsCoGOn = true;
            }

            if (ModChecker.IsCaLoaded(helper))
            {
                Logger.Log("CasksAnywhere detected.");
                IsCaOn = true;
            }

            // Do patching stuff
            if (!Conf.SafeMode)
            {
                HarmonyPatcher.DoPatching();
            }
            else
            {
                Logger.Log("Bypassing patching...");
            }

            helper.WriteConfig(Conf);
            MineIcons.Init(helper);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called firstly when SMAPI finished loading of the mod.
        /// </summary>
        /// <param name="helper"></param>
        public override void Entry(IModHelper helper)
        {
            // Loads configuration from file.
            Config conf = Helper.ReadConfig <Config>();

            // Initialize InstanceHolder.
            InstanceHolder.Init(this, conf);

            // Initialize Logger
            Logger.Init(Monitor);

            // Register events.
            EventHolder.RegisterEvents(Helper.Events);


            // Registration commands.
            Helper.ConsoleCommands.Add("joedebug", "Debug command for JoE", OnDebugCommand);

            // Limit config values.
            ConfigLimitation.LimitConfigValues();

            // Check mod compatibilities.
            if (ModChecker.IsCoGLoaded(helper))
            {
                Logger.Log("CasksOnGround detected.");
                IsCoGOn = true;
            }

            if (ModChecker.IsCaLoaded(helper))
            {
                Logger.Log("CasksAnywhere detected.");
                IsCaOn = true;
            }

            helper.WriteConfig(Conf);
            MineIcons.Init(helper);
        }
Ejemplo n.º 4
0
        public override void Entry(IModHelper helper)
        {
            ModHelper        = helper;
            Util.Helper      = helper;
            Util.Monitor     = Monitor;
            Util.ModInstance = this;

            Conf = helper.ReadConfig <Config>();
            IModEvents Events = Helper.Events;

            Events.Input.ButtonPressed += OnButtonPressed;

            Events.GameLoop.UpdateTicked += OnGameUpdateEvent;

            Events.Display.RenderedHud        += OnPostRenderHud;
            Events.Display.RenderedActiveMenu += OnPostRenderGui;

            Events.Display.MenuChanged += OnMenuChanged;

            Events.GameLoop.Saving += OnBeforeSave;

            Events.GameLoop.DayStarted += OnDayStarted;

            Conf.CpuThresholdFishing      = Util.Cap(Conf.CpuThresholdFishing, 0, 0.5f);
            Conf.HealthToEatRatio         = Util.Cap(Conf.HealthToEatRatio, 0.1f, 0.8f);
            Conf.StaminaToEatRatio        = Util.Cap(Conf.StaminaToEatRatio, 0.1f, 0.8f);
            Conf.AutoCollectRadius        = (int)Util.Cap(Conf.AutoCollectRadius, 1, 3);
            Conf.AutoHarvestRadius        = (int)Util.Cap(Conf.AutoHarvestRadius, 1, 3);
            Conf.AutoPetRadius            = (int)Util.Cap(Conf.AutoPetRadius, 1, 3);
            Conf.AutoWaterRadius          = (int)Util.Cap(Conf.AutoWaterRadius, 1, 3);
            Conf.AutoDigRadius            = (int)Util.Cap(Conf.AutoDigRadius, 1, 3);
            Conf.AutoShakeRadius          = (int)Util.Cap(Conf.AutoShakeRadius, 1, 3);
            Conf.MachineRadius            = (int)Util.Cap(Conf.MachineRadius, 1, 3);
            Conf.RadiusCraftingFromChests = (int)Util.Cap(Conf.RadiusCraftingFromChests, 1, 5);
            Conf.IdleTimeout         = (int)Util.Cap(Conf.IdleTimeout, 1, 300);
            Conf.ScavengingRadius    = (int)Util.Cap(Conf.ScavengingRadius, 1, 3);
            Conf.AnimalHarvestRadius = (int)Util.Cap(Conf.AnimalHarvestRadius, 1, 3);

            if (ModChecker.IsCoGLoaded(helper))
            {
                Monitor.Log("CasksOnGround detected.");
                IsCoGOn = true;
            }

            if (ModChecker.IsCALoaded(helper))
            {
                Monitor.Log("CasksAnywhere detected.");
                IsCAOn = true;
            }

            if (ModChecker.IsCCLoaded(helper))
            {
                Monitor.Log("Convenient Chests detected. JOE's CraftingFromChests feature will be disabled and won't patch the game.");
                Conf.CraftingFromChests = false;
                IsCCOn = true;
            }
            else
            {
                HarmonyPatcher.Init();
            }

            helper.WriteConfig(Conf);
            MineIcons.Init(helper);
        }