1010import joptsimple .OptionSet ;
1111import net .minecraftforge .util .data .json .JsonData ;
1212import net .minecraftforge .util .data .json .MinecraftVersion ;
13- import net .minecraftforge .util .logging .Log ;
13+ import net .minecraftforge .util .logging .Logger ;
1414
1515import java .io .File ;
1616import java .io .FileNotFoundException ;
2424import java .util .zip .ZipFile ;
2525
2626public final class Main {
27+ static final Logger LOGGER = Logger .create ();
28+
2729 public static void main (String [] args ) throws Throwable {
2830 long start = System .currentTimeMillis ();
2931 Launcher launcher ;
3032 try {
31- Log .capture ();
33+ LOGGER .capture ();
3234 launcher = run (args );
3335 } catch (Throwable e ) {
34- Log .release ();
36+ LOGGER .release ();
3537 throw e ;
3638 }
3739
3840 long total = System .currentTimeMillis () - start ;
39- if (Log .isCapturing ()) {
40- Log .drop ();
41- Log . INFO .print ("Slime Launcher setup is up-to-date" );
41+ if (LOGGER .isCapturing ()) {
42+ LOGGER .drop ();
43+ LOGGER . getInfo () .print ("Slime Launcher setup is up-to-date" );
4244 } else {
43- Log . INFO .print ("Slime Launcher has finished setting up" );
45+ LOGGER . getInfo () .print ("Slime Launcher has finished setting up" );
4446 }
45- Log . INFO .println (", took " + total + "ms\n " );
47+ LOGGER . getInfo () .println (", took " + total + "ms\n " );
4648
4749 launcher .run ();
4850 }
@@ -82,14 +84,14 @@ private static Launcher run(String[] args) throws Throwable {
8284 .withRequiredArg ().ofType (String .class );
8385
8486 Package pkg = Main .class .getPackage ();
85- Log .info (pkg .getImplementationTitle () + " " + pkg .getImplementationVersion ());
87+ LOGGER .info (pkg .getImplementationTitle () + " " + pkg .getImplementationVersion ());
8688
8789 SplitArgs split = new SplitArgs (args );
8890
8991 OptionSet options = parser .parse (split .sl );
9092 if (options .has (helpO )) {
91- parser .printHelpOn (Log . INFO );
92- Log .info ("To pass arguments into the main class,\n " +
93+ parser .printHelpOn (LOGGER . getInfo () );
94+ LOGGER .info ("To pass arguments into the main class,\n " +
9395 "add '--' after the Slime Launcher arguments,\n " +
9496 "followed by your main arguments." );
9597 throw new IllegalArgumentException ("Incomplete or invalid arguments" );
@@ -109,12 +111,12 @@ private static Launcher run(String[] args) throws Throwable {
109111 );
110112 }
111113
112- Log .info ("Checking assets" );
113- byte indent = Log .push ();
114+ LOGGER .info ("Checking assets" );
115+ byte indent = LOGGER .push ();
114116 DownloadAssets .download (assetsRepo , assets , versionJson );
115- Log .pop (indent );
117+ LOGGER .pop (indent );
116118
117- Log .info ("Looking for main class: " + mainClass );
119+ LOGGER .info ("Looking for main class: " + mainClass );
118120 MethodHandle mainMethod ;
119121 try {
120122 Class <?> main = Class .forName (mainClass );
@@ -123,7 +125,7 @@ private static Launcher run(String[] args) throws Throwable {
123125 throw new IllegalStateException ("Could not find main class!" , e );
124126 }
125127
126- Log .info ("Sanitizing Minecraft arguments" );
128+ LOGGER .info ("Sanitizing Minecraft arguments" );
127129 for (int i = 0 ; i < split .mc .length ; i ++) {
128130 split .mc [i ] = split .mc [i ]
129131 .replace ("{asset_index}" , versionJson .assetIndex .id )
@@ -146,7 +148,7 @@ private Launcher(String name, MethodHandle main, String[] args) {
146148
147149 @ SuppressWarnings ("ConfusingArgumentToVarargsMethod" )
148150 private void run () throws Throwable {
149- Log .info ("Launching using main class: " + this .name );
151+ LOGGER .info ("Launching using main class: " + this .name );
150152 this .main .invokeExact (this .args );
151153 }
152154 }
0 commit comments