now game launches
This commit is contained in:
parent
f5f6cecc5b
commit
79aa1cd730
@ -69,8 +69,8 @@ internal static partial class Launcher
|
||||
|
||||
private static void LaunchGame(string javapath, string username, string uuid,
|
||||
int maxmemory, int width, int height) =>
|
||||
gameProcess = Process.Start(
|
||||
$"{javapath}\\java.exe -Xms2048M -Xmx{maxmemory}M" +
|
||||
gameProcess = Process.Start($"{javapath}\\javaw.exe",
|
||||
$"-Xms2048M -Xmx{maxmemory}M " +
|
||||
"-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 " +
|
||||
"-XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M -XX:+DisableExplicitGC -XX:+AlwaysPreTouch " +
|
||||
"-XX:+ParallelRefProcEnabled -Xms2048M -Dfile.encoding=UTF-8 " +
|
||||
@ -162,7 +162,12 @@ internal static partial class Launcher
|
||||
".\\libraries\\org\\lwjgl\\lwjgl-tinyfd\\3.3.1\\lwjgl-tinyfd-3.3.1-natives-windows.jar;" +
|
||||
".\\libraries\\org\\lwjgl\\lwjgl-tinyfd\\3.3.1\\lwjgl-tinyfd-3.3.1-natives-windows-x86.jar;" +
|
||||
".\\libraries\\com\\mojang\\text2speech\\1.13.9\\text2speech-1.13.9.jar;" +
|
||||
".\\libraries\\com\\mojang\\text2speech\\1.13.9\\text2speech-1.13.9-natives-windows.jar;.\\versions\\1.19.2-forge-43.1.30\\1.19.2-forge-43.1.30.jar -Djava.net.preferIPv6Addresses=system -DignoreList=bootstraplauncher,securejarhandler,asm-commons,asm-util,asm-analysis,asm-tree,asm,JarJarFileSystems,client-extra,fmlcore,javafmllanguage,lowcodelanguage,mclanguage,forge-,1.19.2-forge-43.1.30.jar -DmergeModules=jna-5.10.0.jar,jna-platform-5.10.0.jar " +
|
||||
".\\libraries\\com\\mojang\\text2speech\\1.13.9\\text2speech-1.13.9-natives-windows.jar;" +
|
||||
".\\versions\\1.19.2-forge-43.1.30\\1.19.2-forge-43.1.30.jar " +
|
||||
"-Djava.net.preferIPv6Addresses=system " +
|
||||
"-DignoreList=bootstraplauncher,securejarhandler,asm-commons,asm-util,asm-analysis,asm-tree,asm," +
|
||||
"JarJarFileSystems,client-extra,fmlcore,javafmllanguage,lowcodelanguage,mclanguage," +
|
||||
"forge-,1.19.2-forge-43.1.30.jar -DmergeModules=jna-5.10.0.jar,jna-platform-5.10.0.jar " +
|
||||
"-DlibraryDirectory=.\\libraries -p " +
|
||||
".\\libraries/cpw/mods/bootstraplauncher/1.1.2/bootstraplauncher-1.1.2.jar;" +
|
||||
".\\libraries/cpw/mods/securejarhandler/2.1.4/securejarhandler-2.1.4.jar;" +
|
||||
|
||||
@ -6,7 +6,7 @@ namespace launcher_client;
|
||||
public class LauncherConfig
|
||||
{
|
||||
public int GameMemory = 3000;
|
||||
public int GameWindowHeight = 1600;
|
||||
public int GameWindowHeight = 500;
|
||||
public int GameWindowWidth = 900;
|
||||
public string JavaPath = $"java{Путь.Разд}bin";
|
||||
public string ServerAddress = "127.0.0.1";
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using DTLib;
|
||||
using DTLib.Dtsod;
|
||||
@ -10,9 +15,11 @@ using DTLib.Extensions;
|
||||
using DTLib.Filesystem;
|
||||
using DTLib.Logging;
|
||||
using DTLib.Network;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace launcher_server;
|
||||
|
||||
namespace launcher_server
|
||||
{
|
||||
static class Server
|
||||
{
|
||||
private static ConsoleLogger Info = new("logs","info");
|
||||
@ -177,7 +184,9 @@ namespace launcher_server
|
||||
}
|
||||
else foreach (string dir in Directory.GetDirectories("share\\sync_and_remove"))
|
||||
FSP.CreateManifest(dir);
|
||||
File.WriteAllText("share\\sync_and_remove\\dirlist.dtsod",
|
||||
if(Directory.GetDirectories("share\\sync_and_remove").Length==0)
|
||||
File.WriteAllText("share\\sync_and_remove\\dirlist.dtsod", "dirs: [ ];");
|
||||
else File.WriteAllText("share\\sync_and_remove\\dirlist.dtsod",
|
||||
"dirs: [\""
|
||||
+Directory.GetDirectories("share\\sync_and_remove")
|
||||
.MergeToString("\", \"").Replace("share\\sync_and_remove\\", "")
|
||||
@ -198,5 +207,16 @@ namespace launcher_server
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static string GetUUID(string username)
|
||||
{
|
||||
var response=new HttpClient().GetAsync(
|
||||
$"https://api.mojang.com/users/profiles/minecraft/{username}")
|
||||
.GetAwaiter().GetResult();
|
||||
var content = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
||||
JObject json = (JObject)JsonConvert.DeserializeObject(content)
|
||||
?? throw new Exception("cant parse to json:\n"+content);
|
||||
var uuid = json["id"] ?? throw new Exception("cant het id from json:\n"+content);
|
||||
return uuid.Value<string>();
|
||||
}
|
||||
}
|
||||
@ -17,4 +17,7 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue
Block a user