<commit_before>﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Menus;
using StardewValleyMP.Interface;
using StardewValleyMP.Platforms;
using StardewValleyMP.Vanilla;
using Steamworks;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using SFarmer = StardewValley.Farmer;

namespace StardewValleyMP
{
    public class MultiplayerMod : Mod
    {
        public static bool DEBUG { get { return ModConfig.Debug; } }

        public static MultiplayerMod instance;
        public static MultiplayerConfig ModConfig { get; private set; }
        public static Assembly a;
        public override void Entry(IModHelper helper)
        {
            instance = this;

            Log.info("Loading Config");
            ModConfig = Helper.ReadConfig<MultiplayerConfig>();

            GameEvents.LoadContent += loadContent;
            GameEvents.UpdateTick += onUpdate;
            GraphicsEvents.OnPreRenderHudEvent += onPreDraw;      
            LocationEvents.CurrentLocationChanged += onCurrentLocationChange;
            ControlEvents.KeyboardChanged += onKeyboardChange;
            SaveEvents.BeforeSave += onBeforeSave;

            Helper.ConsoleCommands.Add("player_unstuck", "...", unstuckCommand);
            Helper.ConsoleCommands.Add("player_sleep", "...", sleepCommand);
            Helper.ConsoleCommands.Add("player_unsleep", "...", unsleepCommand);

            if (DEBUG)
            {
                a = Assembly.GetAssembly(typeof(StardewValley.Game1));
                Util.SetStaticField(a.GetType("StardewValley.Program"), "releaseBuild", false);
            }
        }

        private static void unstuckCommand( string cmd, string[] args )
        {
            Game1.player.canMove = true;
            Game1.freezeControls = false;
            Game1.pauseTime = 0;
            Game1.fadeToBlack = false;
            Game1.player.freezePause = 0;
            Log.info("Done unstucking.");
        }

        private static void sleepCommand(string cmd, string[] args)
        {
            Game1.NewDay(0.0f);
            Log.info("Done sleeping.");
        }

        private static void unsleepCommand(string cmd, string[] args)
        {
            Log.warn("THE SERVER WILL STILL THINK YOU ARE ASLEEP");
            Game1.player.canMove = true;
            Game1.freezeControls = false;
            Game1.pauseTime = 0;
            Game1.fadeToBlack = false;
            Game1.player.freezePause = 0;
            Game1.newDay = false;
            Log.info("Done unsleeping.");
        }

        public static void loadContent( object sender, EventArgs args )
        {
            Util.WHITE_1X1 = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            Util.WHITE_1X1.SetData(new Color[] { Color.White });
        }

        private static IClickableMenu prevMenu = null;<commit_msg>Stop using deprecated event LoadContent<commit_after>﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Menus;
using StardewValleyMP.Interface;
using StardewValleyMP.Platforms;
using StardewValleyMP.Vanilla;
using Steamworks;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using SFarmer = StardewValley.Farmer;

namespace StardewValleyMP
{
    public class MultiplayerMod : Mod
    {
        public static bool DEBUG { get { return ModConfig.Debug; } }

        public static MultiplayerMod instance;
        public static MultiplayerConfig ModConfig { get; private set; }
        public static Assembly a;
        public override void Entry(IModHelper helper)
        {
            instance = this;

            Util.WHITE_1X1 = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            Util.WHITE_1X1.SetData(new Color[] { Color.White });

            Log.info("Loading Config");
            ModConfig = Helper.ReadConfig<MultiplayerConfig>();
            
            GameEvents.UpdateTick += onUpdate;
            GraphicsEvents.OnPreRenderHudEvent += onPreDraw;      
            LocationEvents.CurrentLocationChanged += onCurrentLocationChange;
            ControlEvents.KeyboardChanged += onKeyboardChange;
            SaveEvents.BeforeSave += onBeforeSave;

            Helper.ConsoleCommands.Add("player_unstuck", "...", unstuckCommand);
            Helper.ConsoleCommands.Add("player_sleep", "...", sleepCommand);
            Helper.ConsoleCommands.Add("player_unsleep", "...", unsleepCommand);

            if (DEBUG)
            {
                a = Assembly.GetAssembly(typeof(StardewValley.Game1));
                Util.SetStaticField(a.GetType("StardewValley.Program"), "releaseBuild", false);
            }
        }

        private static void unstuckCommand( string cmd, string[] args )
        {
            Game1.player.canMove = true;
            Game1.freezeControls = false;
            Game1.pauseTime = 0;
            Game1.fadeToBlack = false;
            Game1.player.freezePause = 0;
            Log.info("Done unstucking.");
        }

        private static void sleepCommand(string cmd, string[] args)
        {
            Game1.NewDay(0.0f);
            Log.info("Done sleeping.");
        }

        private static void unsleepCommand(string cmd, string[] args)
        {
            Log.warn("THE SERVER WILL STILL THINK YOU ARE ASLEEP");
            Game1.player.canMove = true;
            Game1.freezeControls = false;
            Game1.pauseTime = 0;
            Game1.fadeToBlack = false;
            Game1.player.freezePause = 0;
            Game1.newDay = false;
            Log.info("Done unsleeping.");
        }

        private static IClickableMenu prevMenu = null;
{'fraction_non_alphanumeric': 0.0929803987267549, 'fraction_numerical': 0.009046741497738315, 'mean_word_length': 2.3129855715871255, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6492232', 'n_tokens_mistral': 1668, 'n_tokens_neox': 1624, 'n_words': 347}