public static boolean isDebug() {
return java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().toString().contains("-agentlib:jdwp");
}
public static void main(String[] args) throws Exception {
LoadingScreen ls = new LoadingScreen();
if (!isDebug()) {
ls.setVisible(true);
build = Util.getBuild();
}
Options options = new Options();
try {
new JCommander(options, args);
} catch (Exception ex) {
ex.printStackTrace();
}
MinecraftUtils.setOptions(options);
recursion = new File(PlatformUtils.getWorkingDirectory(), "rtemp");
args_temp = args;
boolean relaunch = false;
try {
if (!recursion.exists()) {
relaunch = true;
} else {
recursion.delete();
}
} catch (Exception e) {
e.printStackTrace();
}
if (relaunch) {
ls.close();
// if (SettingsUtil.getMemorySelection() < 6) {
int mem = SettingsUtil.getMemorySelection();
if (SettingsUtil.getMemorySelection() < 512) {
SettingsUtil.setMemorySelection(1024);
mem = 1024;
}
recursion.createNewFile();
if (isDebug()) System.exit(0);
else reboot("-Xmx" + mem + "m");
// }
}
if (PlatformUtils.getPlatform() == PlatformUtils.OS.macos) {
try {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Technic Launcher");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignore) {
}
}
PlatformUtils.getWorkingDirectory().mkdirs();
new File(PlatformUtils.getWorkingDirectory(), "launcher").mkdir();
SystemConsoleListener listener = new SystemConsoleListener();
listener.initialize();
Util.log("------------------------------------------");
Util.log("Launcher is starting....");
Util.log("Launcher Build: '%s'", getBuild());
Util.log("Allocated %s Mb of RAM", Runtime.getRuntime().maxMemory() / (1024.0 * 1024));
String javaVM = System.getProperty("java.runtime.version");
if (javaVM != null) Util.log("Java VM: '%s'", javaVM);
String osVersion = System.getProperty("os.version");
if (osVersion != null) Util.log("OS Version: '%s'", osVersion);
String osType = System.getProperty("sun.arch.data.model");
if (osType != null) Util.log("Is 64-bit: '%s'", osType.contains("64"));
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
defaults.put("nimbusOrange", defaults.get("nimbusBase"));
UIManager.put("ProgressBar.selectionForeground", Color.white);
UIManager.put("ProgressBar.selectionBackground", Color.black);
} catch (Exception e) {
Util.log("Warning: Can't get system LnF: " + e);
}
if (GameUpdater.tempDir.exists()) FileUtils.cleanDirectory(GameUpdater.tempDir);
JFrame.setDefaultLookAndFeelDecorated(true);
SettingsUtil.setLatestLWJGL(false);
loginForm = new LoginForm();
loginForm.setLocationByPlatform(true);
loginForm.setVisible(true);
ls.close();
}