@@ -224,14 +224,10 @@ export async function checkGameFiles(metadata) {
224
224
} ) ;
225
225
226
226
if (
227
- ! ( await fs . exists (
228
- join ( constants . DOTLUNARCLIENT , 'offline' , await settings . get ( 'version' ) )
229
- ) )
227
+ ! ( await fs . exists ( join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' ) ) )
230
228
) {
231
229
await fs
232
- . mkdir (
233
- join ( constants . DOTLUNARCLIENT , 'offline' , await settings . get ( 'version' ) )
234
- )
230
+ . mkdir ( join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' ) )
235
231
. catch ( ( error ) => {
236
232
logger . error ( 'Failed to create version folder' , error ) ;
237
233
} ) ;
@@ -242,7 +238,7 @@ export async function checkGameFiles(metadata) {
242
238
const gameFilePath = join (
243
239
constants . DOTLUNARCLIENT ,
244
240
'offline' ,
245
- await settings . get ( 'version' ) ,
241
+ 'multiver' ,
246
242
artifact . name
247
243
) ;
248
244
logger . debug (
@@ -254,12 +250,7 @@ export async function checkGameFiles(metadata) {
254
250
if ( ! ( await fs . exists ( gameFilePath ) ) ) {
255
251
await downloadAndSaveFile (
256
252
artifact . url ,
257
- join (
258
- constants . DOTLUNARCLIENT ,
259
- 'offline' ,
260
- await settings . get ( 'version' ) ,
261
- artifact . name
262
- ) ,
253
+ join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' , artifact . name ) ,
263
254
'blob' ,
264
255
artifact . sha1 ,
265
256
'sha1'
@@ -289,38 +280,18 @@ export async function checkNatives(metadata) {
289
280
) ;
290
281
if (
291
282
await fs . exists (
292
- join (
293
- constants . DOTLUNARCLIENT ,
294
- 'offline' ,
295
- await settings . get ( 'version' ) ,
296
- artifact . name
297
- )
283
+ join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' , artifact . name )
298
284
)
299
285
) {
300
286
if (
301
287
! ( await fs . exists (
302
- join (
303
- constants . DOTLUNARCLIENT ,
304
- 'offline' ,
305
- await settings . get ( 'version' ) ,
306
- 'natives'
307
- )
288
+ join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' , 'natives' )
308
289
) )
309
290
) {
310
291
await extractZip (
311
- join (
312
- constants . DOTLUNARCLIENT ,
313
- 'offline' ,
314
- await settings . get ( 'version' ) ,
315
- artifact . name
316
- ) ,
292
+ join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' , artifact . name ) ,
317
293
{
318
- dir : join (
319
- constants . DOTLUNARCLIENT ,
320
- 'offline' ,
321
- await settings . get ( 'version' ) ,
322
- 'natives'
323
- ) ,
294
+ dir : join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' , 'natives' ) ,
324
295
}
325
296
)
326
297
. then ( ( ) => {
@@ -528,7 +499,7 @@ export async function getJavaArguments(
528
499
const natives = join (
529
500
constants . DOTLUNARCLIENT ,
530
501
'offline' ,
531
- await settings . get ( 'version' ) ,
502
+ 'multiver' ,
532
503
'natives'
533
504
) ;
534
505
@@ -543,8 +514,8 @@ export async function getJavaArguments(
543
514
let version = await settings . get ( 'version' ) ;
544
515
if ( overrideVersion ) version = overrideVersion ;
545
516
546
- const lunarJarFile = async ( filename ) =>
547
- `"${ join ( constants . DOTLUNARCLIENT , 'offline' , version , filename ) } "` ;
517
+ const lunarJarFile = ( filename ) =>
518
+ `"${ join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' , filename ) } "` ;
548
519
549
520
const gameDir =
550
521
( await settings . get ( 'launchDirectories' ) ) . find (
@@ -560,30 +531,27 @@ export async function getJavaArguments(
560
531
561
532
// Make sure the patcher exists, or else the game will crash (jvm init error)
562
533
stat ( patcherPath )
563
- . then ( ( ) =>
534
+ . then ( ( ) => {
564
535
args . push (
565
536
`-javaagent:"${ patcherPath } "="${ join (
566
537
constants . DOTLUNARCLIENT ,
567
538
'solartweaks' ,
568
539
constants . PATCHER . CONFIG
569
540
) } "`
570
- )
571
- )
541
+ ) ;
542
+ } )
572
543
. catch ( ( e ) =>
573
544
logger . warn (
574
545
`Not adding patcher in arguments; ${ patcherPath } does not exist! ${ e } `
575
546
)
576
547
) ;
577
548
578
- const classPath = [
579
- await lunarJarFile ( 'lunar-assets-prod-1-optifine.jar' ) ,
580
- await lunarJarFile ( 'lunar-assets-prod-2-optifine.jar' ) ,
581
- await lunarJarFile ( 'lunar-assets-prod-3-optifine.jar' ) ,
582
- await lunarJarFile ( 'lunar-prod-optifine.jar' ) ,
583
- await lunarJarFile ( 'lunar-libs.jar' ) ,
584
- await lunarJarFile ( 'vpatcher-prod.jar' ) ,
585
- await lunarJarFile ( 'Optifine.jar' ) ,
586
- ] ;
549
+ const classPath = [ ] ;
550
+ metadata . launchTypeData . artifacts
551
+ . filter ( ( a ) => a . type === 'CLASS_PATH' )
552
+ . forEach ( async ( artifact ) => {
553
+ classPath . push ( lunarJarFile ( artifact . name ) ) ;
554
+ } ) ;
587
555
588
556
if ( version === '1.7' )
589
557
classPath . push ( await lunarJarFile ( 'OptiFine_1.7.10_HD_U_E7' ) ) ;
@@ -613,7 +581,16 @@ export async function getJavaArguments(
613
581
'--width' ,
614
582
resolution . width ,
615
583
'--height' ,
616
- resolution . height
584
+ resolution . height ,
585
+ '--ichorClassPath' ,
586
+ classPath . join ( ) ,
587
+ '--ichorExternalFiles' ,
588
+ metadata . launchTypeData . artifacts . find ( ( a ) => a . type === 'EXTERNAL_FILE' )
589
+ . name ,
590
+ '--workingDirectory' ,
591
+ '.' ,
592
+ '--classpathDir' ,
593
+ join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' )
617
594
) ;
618
595
619
596
if ( serverIp ) args . push ( '--server' , `"${ serverIp } "` ) ;
@@ -636,11 +613,11 @@ export async function launchGame(metadata, serverIp = null, debug = false) {
636
613
const version = await settings . get ( 'version' ) ;
637
614
const args = await getJavaArguments ( metadata , serverIp ) ;
638
615
639
- logger . debug ( 'Launching game with args' , args ) ;
616
+ logger . debug ( 'Launching game with args\n\n ' , args . join ( '\n' ) ) ;
640
617
641
618
const javaPath = join ( await settings . get ( 'jrePath' ) , 'java' ) ;
642
619
const proc = await spawn ( javaPath , args , {
643
- cwd : join ( constants . DOTLUNARCLIENT , 'offline' , version ) ,
620
+ cwd : join ( constants . DOTLUNARCLIENT , 'offline' , 'multiver' ) ,
644
621
detached : true ,
645
622
shell : debug ,
646
623
} ) ;
0 commit comments