diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index c5d6ffa9..a4fa4570 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -52,21 +52,6 @@ namespace MinecraftClient /// static void Main(string[] args) { - //Setup ConsoleIO - ConsoleIO.LogPrefix = "§8[MCC] "; - if (args.Length >= 1 && args[args.Length - 1] == "BasicIO" || args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor") - { - if (args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor") - { - ConsoleIO.BasicIO_NoColor = true; - } - ConsoleIO.BasicIO = true; - args = args.Where(o => !Object.ReferenceEquals(o, args[args.Length - 1])).ToArray(); - } - - if (!ConsoleIO.BasicIO) - ConsoleInteractive.ConsoleWriter.Init(); - Task.Factory.StartNew(() => { //Take advantage of Windows 10 / Mac / Linux UTF-8 console @@ -86,6 +71,21 @@ namespace MinecraftClient Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); }); + //Setup ConsoleIO + ConsoleIO.LogPrefix = "§8[MCC] "; + if (args.Length >= 1 && args[args.Length - 1] == "BasicIO" || args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor") + { + if (args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor") + { + ConsoleIO.BasicIO_NoColor = true; + } + ConsoleIO.BasicIO = true; + args = args.Where(o => !Object.ReferenceEquals(o, args[args.Length - 1])).ToArray(); + } + + if (!ConsoleIO.BasicIO) + ConsoleInteractive.ConsoleWriter.Init(); + ConsoleIO.WriteLine($"Minecraft Console Client v{Version} - for MC {MCLowestVersion} to {MCHighestVersion} - Github.com/MCCTeam"); //Build information to facilitate processing of bug reports diff --git a/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs b/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs index b99ecf3c..023f9946 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs @@ -87,7 +87,7 @@ namespace MinecraftClient.Protocol.Handlers //// Block IDs are packed in the array of 64-bits integers dataTypes.SkipNextVarInt(cache); // Entry length Span entryDataByte = stackalloc byte[8]; - Span entryDataLong = MemoryMarshal.Cast(entryDataByte); + Span entryDataLong = MemoryMarshal.Cast(entryDataByte); // Faster than MemoryMarshal.Read Block[] blocks = new Block[Chunk.SizeX * Chunk.SizeY * Chunk.SizeZ]; int startOffset = 64; // Read the first data immediately diff --git a/MinecraftClient/Protocol/Session/SessionToken.cs b/MinecraftClient/Protocol/Session/SessionToken.cs index c7fb780c..37d7476e 100644 --- a/MinecraftClient/Protocol/Session/SessionToken.cs +++ b/MinecraftClient/Protocol/Session/SessionToken.cs @@ -97,7 +97,5 @@ namespace MinecraftClient.Protocol.Session return session; } - - } } diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index f0794927..f5cf5a7b 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -263,39 +263,27 @@ namespace MinecraftClient try { string[] Lines = File.ReadAllLines(file); - - ConcurrentDictionary sectionInfo = new(); - Parallel.For(0, Lines.Length, idx => - { - string line = Lines[idx].Split('#')[0].Trim(); - if (line.Length > 2 && line[0] == '[' && line[^1] == ']') - sectionInfo[idx] = GetSection(line[1..^1]); - }); - Section section = Section.Default; - for (int idx = 0; idx < Lines.Length; ++idx) + foreach (string lineRAW in Lines) { - if (sectionInfo.ContainsKey(idx)) - { - section = sectionInfo[idx]; - continue; - } + string line = lineRAW.Split('#')[0].Trim(); - Parallel.Invoke(() => + if (line.Length > 1) { - string line = Lines[idx].Split('#')[0].Trim(); - if (line.Length > 1) + if (line.Length > 2 && line[0] == '[' && line[^1] == ']') + section = GetSection(line[1..^1]); + else { string argName = line.Split('=')[0]; if (section == Section.Main && argName == "password") - line = Lines[idx].Trim(); //Do not strip # in passwords + line = lineRAW.Trim(); //Do not strip # in passwords if (line.Length > (argName.Length + 1)) { string argValue = line[(argName.Length + 1)..]; LoadSingleSetting(section, argName, argValue); } } - }); + } } } catch (IOException) { }