JewishCat

Untitled

May 15th, 2021 (edited)
1,041
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void RunGame(string Username, string UUID, string Session, string Server, string version, int Memory, string Game_Path, Uri checkUri, string IP, string port, bool autoLoginServer, bool fullScreen)
  2.         {
  3.             string Args = "";
  4.             string tweakClass;
  5.             string assetIndex;
  6.            
  7.             Check_BM(checkUri, Server, Game_Path);
  8.             string BinLib = GetLibJar(Game_Path + Server + "\\libraries", Game_Path + Server);
  9.             string MainClass = "net.minecraft.client.main.Main";
  10.             if (BinLib.Contains("forge"))
  11.             {
  12.                 MainClass = "net.minecraft.launchwrapper.Launch";
  13.             }
  14.             string GameDirectory = Game_Path + Server;
  15.             string Natives_Path = "-Djava.library.path=" + Game_Path + Server + @"\natives";
  16.             string JavaArgs = "-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx" + Memory + "m -XX:UseSSE=2 -XX:+DisableAttachMechanism -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true";
  17.             switch (version)
  18.             {
  19.                 case "1.7.10":
  20.                     assetIndex = "1.7.10";
  21.                     tweakClass = "cpw.mods.fml.common.launcher.FMLTweaker";
  22.                     Args = "--username " + Username + @" --version " + version + " --gameDir " + Game_Path + Server + @" --assetsDir " + Game_Path + @"assets\ --assetIndex " + assetIndex + " --uuid " + UUID + " --accessToken " + Session + " --userProperties {} --userType mojang --height 480 --width 854 --tweakClass " + tweakClass;
  23.                     break;
  24.                 case "1.8.9":
  25.                     assetIndex = "1.8";
  26.                     tweakClass = "net.minecraftforge.fml.common.launcher.FMLTweaker";
  27.                     Args = "--username " + Username + @" --version " + version + " --gameDir " + Game_Path + Server + @" --assetsDir " + Game_Path + @"assets\ --assetIndex " + assetIndex + " --uuid " + UUID + " --accessToken " + Session + " --userType mojang --height 480 --width 854 --tweakClass " + tweakClass;
  28.                     break;
  29.                 case "1.10.2":
  30.                     assetIndex = "1.10";
  31.                     tweakClass = "net.minecraftforge.fml.common.launcher.FMLTweaker";
  32.                     Args = "--username " + Username + @" --version " + version + " --gameDir " + Game_Path + Server + @" --assetsDir " + Game_Path + @"assets\ --assetIndex " + assetIndex + " --uuid " + UUID + " --accessToken " + Session + " --userType mojang --height 480 --width 854 --tweakClass " + tweakClass + " --versionType Forge";
  33.                     break;
  34.                    
  35.             }
  36.  
  37.  
  38.  
  39.             if (fullScreen) Args = Args + " --fullscreen true";
  40.             if (autoLoginServer) Args = Args + " --server " + IP + " --port " + port;
  41.             Java JVM = new Java();
  42.             try
  43.             {
  44.                 Process process = new Process();
  45.                 ProcessStartInfo info = new ProcessStartInfo();
  46.                 if (JVM.GetJava(Game_Path) != null)
  47.                 {
  48.                     info.FileName = JVM.GetJava(Game_Path);
  49.                 }
  50.                 else
  51.                 {
  52.                     Console.WriteLine("Не найдена Java!");
  53.                     return;
  54.                 }
  55.                 info.WorkingDirectory = Game_Path + Server;
  56.                 info.CreateNoWindow = true;
  57.                 info.Arguments = string.Format("{0} {1} {2} {3} {4}", JavaArgs, Natives_Path, BinLib, MainClass, Args);
  58.                 process.StartInfo = info;
  59.                 process.StartInfo.UseShellExecute = false;
  60.                 process.StartInfo.RedirectStandardOutput = true;
  61.                 process.StartInfo.RedirectStandardInput = true;
  62.                 process.StartInfo.CreateNoWindow = true;
  63.                 process.Start();
  64.                
  65.             }
  66.             catch (Exception e)
  67.             {
  68.                 Console.WriteLine("Exc RunGame:" + e.Message);
  69.             }
  70.  
  71.         }
RAW Paste Data