22using CmlLib . Core . Files ;
33using CmlLib . Utils ;
44using Newtonsoft . Json . Linq ;
5- using System ;
6- using System . Collections . Generic ;
75using System . Diagnostics ;
86
97namespace CmlLib . Core . Installer . Forge
@@ -17,15 +15,15 @@ public abstract class ForgeLoader : Func
1715 public event DownloadFileChangedHandler ? FileChanged ;
1816 public event EventHandler < string > ? InstallerOutput ;
1917
20- public ForgeLoader ( MinecraftPath minecraftPath , string JavaPath , CMLauncher launcher ,
18+ public ForgeLoader ( MinecraftPath minecraftPath , string JavaPath , CMLauncher launcher ,
2119 IDownloader downloader , DownloadFileChangedHandler ? FileChanged ,
2220 EventHandler < string > ? InstallerOutput )
2321 {
2422 this . minecraftPath = minecraftPath ;
2523 this . JavaPath = JavaPath ;
2624 this . downloader = downloader ;
2725 this . launcher = launcher ;
28- this . FileChanged = FileChanged ;
26+ this . FileChanged = FileChanged ;
2927 this . InstallerOutput = InstallerOutput ;
3028 }
3129
@@ -83,7 +81,7 @@ public Task checkLibraries(JArray? jarr)
8381 }
8482
8583 public Dictionary < string , string ? > mapping ( JObject data , string kind ,
86- string minecraftJar , string installerPath )
84+ string minecraftJar , string install_folder )
8785 {
8886 var dataMapping = new Dictionary < string , string ? > ( ) ;
8987 foreach ( var item in data )
@@ -98,14 +96,15 @@ public Task checkLibraries(JArray? jarr)
9896 if ( fullPath == value )
9997 {
10098 value = value . Trim ( '/' ) ;
101- dataMapping . Add ( key , Path . Combine ( installerPath , value ) ) ;
99+ dataMapping . Add ( key , Path . Combine ( install_folder , value ) ) ;
102100 }
103101 else
104102 dataMapping . Add ( key , fullPath ) ;
105103 }
106104
107- dataMapping . Add ( "SIDE" , "CLIENT " ) ;
105+ dataMapping . Add ( "SIDE" , "client " ) ;
108106 dataMapping . Add ( "MINECRAFT_JAR" , minecraftJar ) ;
107+ dataMapping . Add ( "INSTALLER" , Path . Combine ( install_folder , "installer.jar" ) ) ;
109108
110109 return dataMapping ;
111110 }
@@ -196,9 +195,6 @@ public void startProcessor(JToken processor, Dictionary<string, string?> mapData
196195
197196 public void startJava ( string [ ] classpath , string mainClass , string [ ] ? args , string install_folder )
198197 {
199- for ( int i = 0 ; i < args . Length ; i ++ )
200- if ( args [ i ] == "{INSTALLER}" )
201- args [ i ] = args [ i ] . Replace ( "{INSTALLER}" , Path . Combine ( install_folder , "installer.jar" ) ) ;
202198 var arg =
203199 $ "-cp { IOUtil . CombinePath ( classpath ) } " +
204200 $ "{ mainClass } ";
@@ -210,7 +206,7 @@ public void startJava(string[] classpath, string mainClass, string[]? args, stri
210206 process . StartInfo = new ProcessStartInfo ( )
211207 {
212208 FileName = JavaPath ,
213- Arguments = arg . Replace ( "--side CLIENT" , "--side client" ) , //fix installertools bug
209+ Arguments = arg ,
214210 } ;
215211
216212 var p = new ProcessUtil ( process ) ;
0 commit comments