Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- {
- string Args = "";
- string tweakClass;
- string assetIndex;
- Check_BM(checkUri, Server, Game_Path);
- string BinLib = GetLibJar(Game_Path + Server + "\\libraries", Game_Path + Server);
- string MainClass = "net.minecraft.client.main.Main";
- if (BinLib.Contains("forge"))
- {
- MainClass = "net.minecraft.launchwrapper.Launch";
- }
- string GameDirectory = Game_Path + Server;
- string Natives_Path = "-Djava.library.path=" + Game_Path + Server + @"\natives";
- 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";
- switch (version)
- {
- case "1.7.10":
- assetIndex = "1.7.10";
- tweakClass = "cpw.mods.fml.common.launcher.FMLTweaker";
- 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;
- break;
- case "1.8.9":
- assetIndex = "1.8";
- tweakClass = "net.minecraftforge.fml.common.launcher.FMLTweaker";
- 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;
- break;
- case "1.10.2":
- assetIndex = "1.10";
- tweakClass = "net.minecraftforge.fml.common.launcher.FMLTweaker";
- 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";
- break;
- }
- if (fullScreen) Args = Args + " --fullscreen true";
- if (autoLoginServer) Args = Args + " --server " + IP + " --port " + port;
- Java JVM = new Java();
- try
- {
- Process process = new Process();
- ProcessStartInfo info = new ProcessStartInfo();
- if (JVM.GetJava(Game_Path) != null)
- {
- info.FileName = JVM.GetJava(Game_Path);
- }
- else
- {
- Console.WriteLine("Не найдена Java!");
- return;
- }
- info.WorkingDirectory = Game_Path + Server;
- info.CreateNoWindow = true;
- info.Arguments = string.Format("{0} {1} {2} {3} {4}", JavaArgs, Natives_Path, BinLib, MainClass, Args);
- process.StartInfo = info;
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.RedirectStandardOutput = true;
- process.StartInfo.RedirectStandardInput = true;
- process.StartInfo.CreateNoWindow = true;
- process.Start();
- }
- catch (Exception e)
- {
- Console.WriteLine("Exc RunGame:" + e.Message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement