optimize the code.
This commit is contained in:
@@ -35,7 +35,6 @@ import org.jackhuang.hellominecraft.utils.DoubleOutputStream;
|
|||||||
import org.jackhuang.hellominecraft.utils.JdkVersion;
|
import org.jackhuang.hellominecraft.utils.JdkVersion;
|
||||||
import org.jackhuang.hellominecraft.utils.LauncherPrintStream;
|
import org.jackhuang.hellominecraft.utils.LauncherPrintStream;
|
||||||
import org.jackhuang.hellominecraft.utils.MessageBox;
|
import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||||
import org.jackhuang.hellominecraft.utils.OS;
|
|
||||||
import org.jackhuang.hellominecraft.utils.Platform;
|
import org.jackhuang.hellominecraft.utils.Platform;
|
||||||
import org.jackhuang.hellominecraft.utils.Utils;
|
import org.jackhuang.hellominecraft.utils.Utils;
|
||||||
|
|
||||||
@@ -106,15 +105,16 @@ public final class Launcher {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JdkVersion.isJava64Bit() && OS.getPlatform() == Platform.BIT_32)
|
if (!JdkVersion.isJava64Bit() && Platform.getPlatform() == Platform.BIT_32)
|
||||||
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
||||||
|
|
||||||
Method minecraftMain;
|
Method minecraftMain;
|
||||||
try {
|
try {
|
||||||
minecraftMain = new URLClassLoader(urls).loadClass(mainClass).getMethod("main", String[].class);
|
minecraftMain = new URLClassLoader(urls).loadClass(mainClass).getMethod("main", String[].class);
|
||||||
} catch (Throwable t) {
|
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException t) {
|
||||||
MessageBox.Show(C.i18n("crash.main_class_not_found"));
|
MessageBox.Show(C.i18n("crash.main_class_not_found"));
|
||||||
println("Minecraft main class not found.");
|
println("Minecraft main class not found.");
|
||||||
|
t.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program.
|
|
||||||
*/
|
|
||||||
package org.jackhuang.hellominecraft.launcher.launch;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author hyh
|
|
||||||
*/
|
|
||||||
public enum GameLauncherRequest {
|
|
||||||
|
|
||||||
ERROR,
|
|
||||||
DOWNLOAD_ASSETS,
|
|
||||||
DOWNLOAD_LIBRARIES,
|
|
||||||
UNZIP_LIBRARIES,
|
|
||||||
PROCESS_STARTED,
|
|
||||||
SUCCEED
|
|
||||||
}
|
|
||||||
@@ -88,7 +88,7 @@ public abstract class IMinecraftLoader {
|
|||||||
res.add("-Xmn128m");
|
res.add("-Xmn128m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jv != null && jv.platform == Platform.BIT_32 && OS.getPlatform() == Platform.BIT_64)
|
if (jv != null && jv.platform == Platform.BIT_32 && Platform.getPlatform() == Platform.BIT_64)
|
||||||
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
||||||
|
|
||||||
if (!StrUtils.isBlank(v.getMaxMemory())) {
|
if (!StrUtils.isBlank(v.getMaxMemory())) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class MinecraftLoader extends IMinecraftLoader {
|
|||||||
t = t.replace("${assets_root}", provider.getAssets().getAbsolutePath());
|
t = t.replace("${assets_root}", provider.getAssets().getAbsolutePath());
|
||||||
t = t.replace("${auth_access_token}", lr.getAccessToken());
|
t = t.replace("${auth_access_token}", lr.getAccessToken());
|
||||||
t = t.replace("${user_type}", lr.getUserType());
|
t = t.replace("${user_type}", lr.getUserType());
|
||||||
t = t.replace("${assets_index_name}", version.assets == null ? "legacy" : version.assets);
|
t = t.replace("${assets_index_name}", version.getAssets());
|
||||||
t = t.replace("${user_properties}", lr.getUserProperties());
|
t = t.replace("${user_properties}", lr.getUserProperties());
|
||||||
t = t.replace("${user_property_map}", lr.getUserPropertyMap());
|
t = t.replace("${user_property_map}", lr.getUserPropertyMap());
|
||||||
res.add(t);
|
res.add(t);
|
||||||
@@ -117,7 +117,7 @@ public class MinecraftLoader extends IMinecraftLoader {
|
|||||||
File assetsDir = new File(provider.getBaseFolder(), "assets");
|
File assetsDir = new File(provider.getBaseFolder(), "assets");
|
||||||
File indexDir = new File(assetsDir, "indexes");
|
File indexDir = new File(assetsDir, "indexes");
|
||||||
File objectDir = new File(assetsDir, "objects");
|
File objectDir = new File(assetsDir, "objects");
|
||||||
String assetVersion = version.assets == null ? "legacy" : version.assets;
|
String assetVersion = version.getAssets();
|
||||||
File indexFile = new File(indexDir, assetVersion + ".json");
|
File indexFile = new File(indexDir, assetVersion + ".json");
|
||||||
File virtualRoot = new File(new File(assetsDir, "virtual"), assetVersion);
|
File virtualRoot = new File(new File(assetsDir, "virtual"), assetVersion);
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hellominecraft.launcher.utils.assets;
|
package org.jackhuang.hellominecraft.launcher.utils.assets;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import org.jackhuang.hellominecraft.HMCLog;
|
import org.jackhuang.hellominecraft.HMCLog;
|
||||||
import org.jackhuang.hellominecraft.utils.EventHandler;
|
import org.jackhuang.hellominecraft.utils.EventHandler;
|
||||||
import org.jackhuang.hellominecraft.utils.MathUtils;
|
import org.jackhuang.hellominecraft.utils.MathUtils;
|
||||||
@@ -27,6 +29,7 @@ import org.w3c.dom.Document;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -39,8 +42,8 @@ public class AssetsLoader extends Thread {
|
|||||||
NodeList nodes;
|
NodeList nodes;
|
||||||
public String uri;
|
public String uri;
|
||||||
ArrayList<Contents> al;
|
ArrayList<Contents> al;
|
||||||
public final EventHandler<Throwable> failedEvent = new EventHandler<Throwable>(this);
|
public final EventHandler<Throwable> failedEvent = new EventHandler<>(this);
|
||||||
public final EventHandler<List<Contents>> successEvent = new EventHandler<List<Contents>>(this);
|
public final EventHandler<List<Contents>> successEvent = new EventHandler<>(this);
|
||||||
|
|
||||||
AssetsLoader(String uri) {
|
AssetsLoader(String uri) {
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
@@ -74,7 +77,7 @@ public class AssetsLoader extends Thread {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Thread.currentThread().setName("AssetsLoader");
|
Thread.currentThread().setName("AssetsLoader");
|
||||||
al = new ArrayList<Contents>();
|
al = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
HMCLog.log("AssetsLoader - Download begin.");
|
HMCLog.log("AssetsLoader - Download begin.");
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
@@ -94,7 +97,7 @@ public class AssetsLoader extends Thread {
|
|||||||
HMCLog.log("AssetsLoader - Format end.");
|
HMCLog.log("AssetsLoader - Format end.");
|
||||||
|
|
||||||
successEvent.execute(al);
|
successEvent.execute(al);
|
||||||
} catch (Exception e) {
|
} catch (ParserConfigurationException | SAXException | IOException e) {
|
||||||
HMCLog.warn("AssetsLoader - Failed", e);
|
HMCLog.warn("AssetsLoader - Failed", e);
|
||||||
failedEvent.execute(e);
|
failedEvent.execute(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ public final class OfflineAuthenticator extends IAuthenticator {
|
|||||||
UserProfileProvider result = new UserProfileProvider();
|
UserProfileProvider result = new UserProfileProvider();
|
||||||
result.setSuccess(StrUtils.isNotBlank(info.username));
|
result.setSuccess(StrUtils.isNotBlank(info.username));
|
||||||
result.setUserName(info.username);
|
result.setUserName(info.username);
|
||||||
String md5 = DigestUtils.md5Hex(info.username);
|
String uuid = getUUIDFromUserName(info.username);
|
||||||
String uuid = md5.substring(0, 8) + '-' + md5.substring(8, 12) + '-' + md5.substring(12, 16) + '-' + md5.substring(16, 21) + md5.substring(21);
|
|
||||||
result.setSession(uuid);
|
result.setSession(uuid);
|
||||||
result.setUserId(uuid);
|
result.setUserId(uuid);
|
||||||
result.setAccessToken("${auth_access_token}");
|
result.setAccessToken("${auth_access_token}");
|
||||||
@@ -44,6 +43,11 @@ public final class OfflineAuthenticator extends IAuthenticator {
|
|||||||
result.setErrorReason(C.i18n("login.no_Player007"));
|
result.setErrorReason(C.i18n("login.no_Player007"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getUUIDFromUserName(String str) {
|
||||||
|
String md5 = DigestUtils.md5Hex(str);
|
||||||
|
return md5.substring(0, 8) + '-' + md5.substring(8, 12) + '-' + md5.substring(12, 16) + '-' + md5.substring(16, 21) + md5.substring(21);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public final class YggdrasilAuthenticator extends IAuthenticator {
|
|||||||
}
|
}
|
||||||
result.setUserName(username);
|
result.setUserName(username);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setUserId(UUIDTypeAdapter.fromUUID(selectedProfile.getId()));
|
result.setUserId(selectedProfile == null ? OfflineAuthenticator.getUUIDFromUserName(username) : UUIDTypeAdapter.fromUUID(selectedProfile.getId()));
|
||||||
result.setUserProperties(new GsonBuilder().registerTypeAdapter(PropertyMap.class, new LegacyPropertyMapSerializer()).create().toJson(ua.getUserProperties()));
|
result.setUserProperties(new GsonBuilder().registerTypeAdapter(PropertyMap.class, new LegacyPropertyMapSerializer()).create().toJson(ua.getUserProperties()));
|
||||||
result.setUserPropertyMap(new GsonBuilder().registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create().toJson(ua.getUserProperties()));
|
result.setUserPropertyMap(new GsonBuilder().registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create().toJson(ua.getUserProperties()));
|
||||||
result.setAccessToken(ua.getAuthenticatedToken());
|
result.setAccessToken(ua.getAuthenticatedToken());
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
|
|||||||
*
|
*
|
||||||
* @author hyh
|
* @author hyh
|
||||||
*/
|
*/
|
||||||
public abstract class IMinecraftLibrary {
|
public abstract class IMinecraftLibrary implements Cloneable {
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
public IMinecraftLibrary(String name) {
|
public IMinecraftLibrary(String name) {
|
||||||
@@ -50,7 +50,7 @@ public abstract class IMinecraftLibrary {
|
|||||||
hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0);
|
hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected abstract Object clone();
|
public abstract Object clone();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,13 +21,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
|
import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
|
||||||
import org.jackhuang.hellominecraft.utils.OS;
|
import org.jackhuang.hellominecraft.utils.OS;
|
||||||
|
import org.jackhuang.hellominecraft.utils.Platform;
|
||||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author hyh
|
* @author hyh
|
||||||
*/
|
*/
|
||||||
public class MinecraftLibrary extends IMinecraftLibrary implements Cloneable {
|
public class MinecraftLibrary extends IMinecraftLibrary {
|
||||||
|
|
||||||
public ArrayList<Rules> rules;
|
public ArrayList<Rules> rules;
|
||||||
public String url, formatted=null;
|
public String url, formatted=null;
|
||||||
@@ -72,10 +73,7 @@ public class MinecraftLibrary extends IMinecraftLibrary implements Cloneable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (r.os != null && (StrUtils.isBlank(r.os.name) || r.os.name.equalsIgnoreCase(OS.os().toString()))) {
|
if (r.os == null || (r.os != null && (StrUtils.isBlank(r.os.name) || r.os.name.equalsIgnoreCase(OS.os().toString())))) {
|
||||||
flag = true;
|
|
||||||
}
|
|
||||||
if (r.os == null) {
|
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,16 +83,7 @@ public class MinecraftLibrary extends IMinecraftLibrary implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String formatArch(String nati) {
|
private String formatArch(String nati) {
|
||||||
String arch = System.getProperty("os.arch");
|
return nati == null ? "" : nati.replace("${arch}", Platform.getPlatform().getBit());
|
||||||
if (arch.contains("64")) {
|
|
||||||
arch = "64";
|
|
||||||
} else {
|
|
||||||
arch = "32";
|
|
||||||
}
|
|
||||||
if (nati == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return nati.replace("${arch}", arch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNative() {
|
private String getNative() {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftProvider;
|
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftProvider;
|
||||||
|
import org.jackhuang.hellominecraft.launcher.utils.assets.AssetsIndex;
|
||||||
import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
|
import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
|
||||||
import org.jackhuang.hellominecraft.utils.ArrayUtils;
|
import org.jackhuang.hellominecraft.utils.ArrayUtils;
|
||||||
|
|
||||||
@@ -117,6 +118,10 @@ public class MinecraftVersion implements Cloneable, Comparable<MinecraftVersion>
|
|||||||
public boolean isAllowedToUnpackNatives() {
|
public boolean isAllowedToUnpackNatives() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAssets() {
|
||||||
|
return assets == null ? AssetsIndex.DEFAULT_ASSET_NAME : assets;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(MinecraftVersion o) {
|
public int compareTo(MinecraftVersion o) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public final class MinecraftVersionManager extends IMinecraftProvider {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MinecraftVersion mcVersion = null;
|
MinecraftVersion mcVersion;
|
||||||
try {
|
try {
|
||||||
mcVersion = gson.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class);
|
mcVersion = gson.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class);
|
||||||
if (mcVersion == null) throw new RuntimeException("Wrong json format, got null.");
|
if (mcVersion == null) throw new RuntimeException("Wrong json format, got null.");
|
||||||
@@ -142,7 +142,7 @@ public final class MinecraftVersionManager extends IMinecraftProvider {
|
|||||||
HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", ex);
|
HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", ex);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
} else continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (!id.equals(mcVersion.id)) {
|
if (!id.equals(mcVersion.id)) {
|
||||||
|
|||||||
@@ -1176,7 +1176,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile getProfile() {
|
final Profile getProfile() {
|
||||||
if (cboProfiles.getSelectedIndex() >= 0)
|
if (cboProfiles.getSelectedIndex() >= 0)
|
||||||
return Settings.getVersion(cboProfiles.getSelectedItem().toString());
|
return Settings.getVersion(cboProfiles.getSelectedItem().toString());
|
||||||
else return null;
|
else return null;
|
||||||
@@ -1346,9 +1346,9 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
|||||||
while (model.getRowCount() > 0)
|
while (model.getRowCount() > 0)
|
||||||
model.removeRow(0);
|
model.removeRow(0);
|
||||||
String mcver = StrUtils.formatVersion(getMinecraftVersionFormatted());
|
String mcver = StrUtils.formatVersion(getMinecraftVersionFormatted());
|
||||||
List<InstallerVersionList.InstallerVersion> versions = list.getVersions(mcver);
|
List<InstallerVersionList.InstallerVersion> ver = list.getVersions(mcver);
|
||||||
if (versions != null) {
|
if (ver != null) {
|
||||||
for (InstallerVersionList.InstallerVersion v : versions) {
|
for (InstallerVersionList.InstallerVersion v : ver) {
|
||||||
Object a = v.selfVersion == null ? "null" : v.selfVersion;
|
Object a = v.selfVersion == null ? "null" : v.selfVersion;
|
||||||
Object b = v.mcVersion == null ? "null" : v.mcVersion;
|
Object b = v.mcVersion == null ? "null" : v.mcVersion;
|
||||||
Object[] row = new Object[]{a, b};
|
Object[] row = new Object[]{a, b};
|
||||||
@@ -1356,7 +1356,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
|||||||
}
|
}
|
||||||
table.updateUI();
|
table.updateUI();
|
||||||
}
|
}
|
||||||
return versions;
|
return ver;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hellominecraft.launcher.views;
|
package org.jackhuang.hellominecraft.launcher.views;
|
||||||
|
|
||||||
import com.sun.awt.AWTUtilities;
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.CardLayout;
|
import java.awt.CardLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@@ -85,7 +84,8 @@ public final class MainFrame extends DraggableFrame {
|
|||||||
|
|
||||||
if (enableShadow)
|
if (enableShadow)
|
||||||
try {
|
try {
|
||||||
AWTUtilities.setWindowOpaque(this, false);
|
//AWTUtilities.setWindowOpaque(this, false);
|
||||||
|
setBackground(new Color(0,0,0,0));
|
||||||
getRootPane().setBorder(border = new DropShadowBorder(borderColor, 4));
|
getRootPane().setBorder(border = new DropShadowBorder(borderColor, 4));
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
HMCLog.err("Failed to set window transparent.", ex);
|
HMCLog.err("Failed to set window transparent.", ex);
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ import org.jackhuang.hellominecraft.launcher.utils.settings.Settings;
|
|||||||
*/
|
*/
|
||||||
public final class NewProfileWindow extends javax.swing.JDialog {
|
public final class NewProfileWindow extends javax.swing.JDialog {
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new form NewProfileWindow
|
|
||||||
*/
|
|
||||||
public NewProfileWindow(java.awt.Frame parent) {
|
public NewProfileWindow(java.awt.Frame parent) {
|
||||||
super(parent, true);
|
super(parent, true);
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ public enum OS {
|
|||||||
return OS.UNKOWN;
|
return OS.UNKOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Platform getPlatform() {
|
|
||||||
String arch = System.getProperty("os.arch");
|
|
||||||
return arch.contains("64") ? Platform.BIT_64 : Platform.BIT_32;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Free Physical Memory Size (Byte)
|
* @return Free Physical Memory Size (Byte)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,7 +21,36 @@ package org.jackhuang.hellominecraft.utils;
|
|||||||
* @author huangyuhui
|
* @author huangyuhui
|
||||||
*/
|
*/
|
||||||
public enum Platform {
|
public enum Platform {
|
||||||
UNKNOWN,
|
|
||||||
BIT_32,
|
UNKNOWN {
|
||||||
BIT_64
|
|
||||||
|
@Override
|
||||||
|
public String getBit() {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
BIT_32 {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBit() {
|
||||||
|
return "32";
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
BIT_64 {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBit() {
|
||||||
|
return "64";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
public abstract String getBit();
|
||||||
|
|
||||||
|
public static Platform getPlatform() {
|
||||||
|
String arch = System.getProperty("os.arch");
|
||||||
|
return arch.contains("64") ? Platform.BIT_64 : Platform.BIT_32;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ Hello Minecraft! Launcher is a Minecraft launcher.
|
|||||||
### Joining
|
### Joining
|
||||||
If you really want to join the development, here's some requests.
|
If you really want to join the development, here's some requests.
|
||||||
* The Development Environment is Netbeans 8.0.2 with Gradle Support plugin.
|
* The Development Environment is Netbeans 8.0.2 with Gradle Support plugin.
|
||||||
* The project is built in Java 1.8, using the retrolambda backported to Java 1.7. So DO NOT use the libraries of Java 8 like Stream APIs.
|
* The project is built on Java 1.8, using the retrolambda backported to Java 1.7. So DO NOT use the libraries of Java 8 like Stream APIs.
|
||||||
* DO NOT modify *.gradle.
|
* DO NOT modify *.gradle.
|
||||||
|
|||||||
Reference in New Issue
Block a user