From fdc2570945b46ae749d934623c1b467bda600ab7 Mon Sep 17 00:00:00 2001 From: huangyuhui Date: Sun, 7 Feb 2016 14:39:47 +0800 Subject: [PATCH] Now supports modpack description! --- HMCL/modpack.zip | Bin 0 -> 2417 bytes .../core/auth/SkinmeAuthenticator.java | 14 +- .../core/auth/YggdrasilAuthenticator.java | 11 +- .../launcher/core/mod/ModpackManager.java | 41 ++++- .../core/version/MinecraftLibrary.java | 3 +- .../core/version/MinecraftVersionManager.java | 114 +++++++------- .../setting/DefaultMinecraftService.java | 11 ++ .../launcher/setting/Profile.java | 7 +- .../ui/modpack/ModpackDescriptionPanel.form | 44 ++++++ .../ui/modpack/ModpackDescriptionPanel.java | 84 ++++++++++ .../modpack/ModpackInitializationPanel.form | 31 +++- .../modpack/ModpackInitializationPanel.java | 39 ++++- .../launcher/ui/modpack/ModpackWizard.java | 15 +- .../launcher/util/CrashReporter.java | 65 ++++---- .../hellominecraft/util/ui/Selector.form | 101 ------------ .../hellominecraft/util/ui/Selector.java | 146 ------------------ .../hellominecraft/util/ui/SwingUtils.java | 12 ++ .../jackhuang/hellominecraft/lang/I18N.lang | 9 +- .../hellominecraft/lang/I18N.properties | 9 +- .../hellominecraft/lang/I18N_en.lang | 5 + .../hellominecraft/lang/I18N_en.properties | 5 + .../hellominecraft/lang/I18N_zh_CN.lang | 9 +- .../hellominecraft/lang/I18N_zh_CN.properties | 9 +- .../hellominecraft/lang/I18N_zh_TW.lang | 13 +- .../hellominecraft/lang/I18N_zh_TW.properties | 13 +- common.gradle~ | 81 ++++++++++ 26 files changed, 501 insertions(+), 390 deletions(-) create mode 100644 HMCL/modpack.zip create mode 100644 HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.form create mode 100644 HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.java delete mode 100755 HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.form delete mode 100755 HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.java create mode 100755 common.gradle~ diff --git a/HMCL/modpack.zip b/HMCL/modpack.zip new file mode 100644 index 0000000000000000000000000000000000000000..c23f9c5b2f7ba227c5a460404825a1cec0ce2c30 GIT binary patch literal 2417 zcmb7GdpMJQA0H+XQO#OrW}wxU-xz0zx%$wpX+yhf8Xo#`QWTYfFOXlxH!Nr z*wPB{6Ci8PWFLP5KG4%USTm3iLk(II!9@mK<$xw?`LygJ=KxpmrVA>$Zqdm6b%lBZMZkHvIEsY~WUj`G8#d$kX+^h*Ls2eKjbO~;r%bc-8h zwo1L3US%&Nit2X5k>Aj2d$lFwx0%~#iO(dQ4maBRmw0d9^+JJ+`>N88Tc0nqD zUK~JKgL*tx4J+lXG3L;iOw90CcT#Z1vZ+K36=O8ljSE&%SuR07nei zkDlcUJ;8r3yZaudcdQ?CVAM_Q_3{^7I-|?jJjVoFJ!xAo(cH)0`d(1m$>@I zU7BVBt$}etA%>7@@?^&J$EMk8mZmYRMukxH+5{6W-e^3E`EH>`Om7L@ba^PIy?uts zi-zJqCA7TPofVsrX#!Ss_TNs}eXQ%?}iEGxc6ZH#xZwFZ`GtMUQIMvJe1Z z4Fs&Me>a0N8)hfSGnDZE&EAd;^@7>e@C~B)kGfb>M)YKud>4oXC7Coq=xl;>H13(! zWp1MF2X9j8JLrK0S*cxuEZrZmZP5cZSBz3J_C}^qkn;U0h;&xPoMb%|xg2H{JvGHki4 zX934e;U#0&bVEdwg9Bs7q?uz?f=Y zJM8O#aAjLY)Mo&y_i!F{c)aXS$cy8nFQw(q%#mrA0}@441%CV#&eylJzeq_+B(zNOALwbo)g0nLQC8B z5xtt7w;YvIix|D&3h=B?d}p2(XJkhqkur(A!^eww;gwxqfFn(h10br_V0e{b>)9*3 z`Ys;^EF=``TA8d}w)cMa`}5`5xy4uAI8Mc>bEO)>WYUvszGFhYk1E(TPp3{-zdZk} zw9Y6IiJ<}uVz!|7hb5<0zu-d_Um&~1O!4%cqWJ-pH!9kw*?s2O?beJ@LX&I3ad3sF z+*m1MDWo`4i#VUvy~6Bmnq$`#EzdpM+spEm*1e{woV3HzNIw4&sGvXS?bXS^oIaJO zJ`A_}?1PNk=G)8?I|;kW#}BK4G43m}RPOTB3CC~C{1yTxX=EtIfPDLHLmpk{LC!;c z?&jNY^ngbR!jP0PjJ8+ycd&Y5mDoD2(+L;gJxpbgldVVDn zez8jNiTqEpuqaLTVWNnlXIlI|IYjv&N!@J+>118>WgZgsCEzQ3I#$Drl}M(SIq44q z>AP0)7GKU7ocnIm8sWE~cjZK=&3H!an}Q=#wHc{!zhbH{6|7QWKO+B}Ms_8SmeHSd z&ba?EwB^2Pxm2-?On6crq?!NrN&RPR2Ug1|B=Y8>o_kVZij!;}JkHU_4iAUgEE~(D znrauEGQ5hm6w+Xwg5-XVY^d??WsP=mH3xID;S^3!D)Z0Xr^jp3a(L);<`&cpJ%2!q zeeR-Ky+NYiAHh-_=G3;Yu~COa()ZJ!;%OkqBs%ACqv^PnM)SS9&+8-<>~5(-)kz|{ zwXtsY>><8#fMZyNX&RdDUiTN;dA@3|9UphR-6^U5^kmS%8zmy}X7Vdlw|AV#+F@^8 zYMTLm&v%PM`Uw_JCAO0Oxk{atKAtOI&qx%SekfAq@umwA?!T!yoPW&cKPa}UNqv^_Crk^NTu|xsX}BcWgkG@&4z0Ml6*+aY%DTZM5uEfp*|B5nBj@^s=5dMTUORcfnf99>xT1;?XH5+9 zzpli!?p)ACHnUcrHh&{t@;d}fe`Lm2H=lj8bu4^#)iII#NxL!h=ITS#xz$|;N&QPk zG`uWq6(}&(8nYX%S!<%$x29dc7e+~euu;7JQM9{b4mezgb(hVtDhHgJU6&AA1(xcH z^$iHL_eNp7BNWhBOC=qb+&#+2l;HP^>yIcQObT~v>$~M1)YUe#zjzn?LzROe3Q=Zj z)HZ83&RR$q1lX7j{&ssoHrR;YC52yEe%5_KGFXQoe5|vq=Y(Gw1QmbpL*NhVh+TWV z&hTHi__g}y_6po#9gjCu|I^uD34U&o;1t%8BewBOaMq%m1YbqhF4UUU$^8gS{{gc; B)nWhu literal 0 HcmV?d00001 diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/SkinmeAuthenticator.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/SkinmeAuthenticator.java index b36832a62..f173bf932 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/SkinmeAuthenticator.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/SkinmeAuthenticator.java @@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.util.C; import org.jackhuang.hellominecraft.util.code.DigestUtils; import org.jackhuang.hellominecraft.util.NetUtils; import org.jackhuang.hellominecraft.util.lang.SupportedLocales; -import org.jackhuang.hellominecraft.util.ui.Selector; +import org.jackhuang.hellominecraft.util.ui.SwingUtils; /** * @@ -61,15 +61,14 @@ public final class SkinmeAuthenticator extends IAuthenticator { if (sl[1].contains("No Valid Character")) sl[1] = C.i18n("login.no_valid_character"); throw new AuthenticationException(sl[1]); - case "1": { + case "1": String[] s = parseType1(sl[1]); req.setUserName(s[0]); req.setSession(s[1]); req.setUserId(s[1]); req.setAccessToken(s[1]); break; - } - case "2": { + case "2": String[] charators = sl[1].split(";"); int len = charators.length; String[] $char = new String[len]; @@ -80,12 +79,10 @@ public final class SkinmeAuthenticator extends IAuthenticator { $char[i] = charator[0]; user[i] = charator[1]; } - Selector s = new Selector(null, user, C.i18n("login.choose_charactor")); - s.setVisible(true); - if (s.sel == Selector.FAILED_TO_SELECT) + int index = SwingUtils.select(user, C.i18n("login.choose_charactor")); + if (index == -1) throw new AuthenticationException(C.i18n("message.cancelled")); else { - int index = s.sel; String character = $char[index]; sl = getCharacter(usr, hashCode, character).split(":"); String[] s2 = parseType1(sl[1]); @@ -96,7 +93,6 @@ public final class SkinmeAuthenticator extends IAuthenticator { } break; } - } req.setUserType("Legacy"); return req; diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/YggdrasilAuthenticator.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/YggdrasilAuthenticator.java index 0255e421a..eefca9fac 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/YggdrasilAuthenticator.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/auth/YggdrasilAuthenticator.java @@ -23,11 +23,11 @@ import java.util.Map; import javax.swing.JOptionPane; import org.jackhuang.hellominecraft.util.C; import org.jackhuang.hellominecraft.util.ArrayUtils; -import org.jackhuang.hellominecraft.util.ui.Selector; import org.jackhuang.hellominecraft.launcher.core.auth.yggdrasil.GameProfile; import org.jackhuang.hellominecraft.launcher.core.auth.yggdrasil.PropertyMap; import org.jackhuang.hellominecraft.launcher.core.auth.yggdrasil.YggdrasilAuthentication; import org.jackhuang.hellominecraft.launcher.core.auth.yggdrasil.UUIDTypeAdapter; +import org.jackhuang.hellominecraft.util.ui.SwingUtils; /** * @@ -69,12 +69,11 @@ public final class YggdrasilAuthenticator extends IAuthenticator { String[] names = new String[profiles.length]; for (int i = 0; i < profiles.length; i++) names[i] = profiles[i].name; - Selector s = new Selector(null, names, C.i18n("login.choose_charactor")); - s.setVisible(true); - if (s.sel == Selector.FAILED_TO_SELECT) + int sel = SwingUtils.select(names, C.i18n("login.choose_charactor")); + if (sel == -1) throw new AuthenticationException("No selection"); - selectedProfile = profiles[s.sel]; - username = names[s.sel]; + selectedProfile = profiles[sel]; + username = names[sel]; } else username = JOptionPane.showInputDialog(C.i18n("login.no_charactor")); else diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/mod/ModpackManager.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/mod/ModpackManager.java index efabe62e7..1e7793af2 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/mod/ModpackManager.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/mod/ModpackManager.java @@ -20,18 +20,23 @@ package org.jackhuang.hellominecraft.launcher.core.mod; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStreamReader; import java.nio.file.FileSystemException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import java.util.zip.ZipFile; import org.jackhuang.hellominecraft.util.C; import org.jackhuang.hellominecraft.util.logging.HMCLog; import org.jackhuang.hellominecraft.launcher.core.GameException; import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftProvider; import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService; import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion; +import org.jackhuang.hellominecraft.util.MessageBox; import org.jackhuang.hellominecraft.util.func.BiFunction; import org.jackhuang.hellominecraft.util.system.Compressor; import org.jackhuang.hellominecraft.util.system.FileUtils; @@ -59,12 +64,25 @@ import org.jackhuang.hellominecraft.util.version.MinecraftVersionRequest; */ public final class ModpackManager { - public static Task install(final File input, final IMinecraftService service, final String id) { + /** + * Install the compressed modpack. + * + * @param input modpack.zip + * @param service MinecraftService, whose version service only supports + * MinecraftVersionManager. + * @param id new version id, if null, will use suggested name from + * modpack + * + * @return The installing Task, may take long time, please consider + * TaskWindow. + */ + public static Task install(final File input, final IMinecraftService service, final String idFUCK) { return new Task() { Collection c = new ArrayList<>(); @Override public void executeTask() throws Throwable { + String id = idFUCK; File versions = new File(service.baseDirectory(), "versions"); File oldFile = new File(versions, "minecraft"), newFile = null; if (oldFile.exists()) { @@ -78,6 +96,24 @@ public final class ModpackManager { HMCLog.warn("Failed to rename " + oldFile + " to " + newFile); } + String description = C.i18n("modpack.install.will_install"); + + try (ZipFile zip = new ZipFile(input)) { + HashMap map = C.GSON.fromJson(new InputStreamReader(zip.getInputStream(zip.getEntry("modpack.json"))), HashMap.class); + if (map != null) { + if (id == null) + if (map.containsKey("name") && map.get("name") instanceof String) + id = (String) map.get("name"); + if (map.containsKey("description") && map.get("description") instanceof String) + description += "\n" + (String) map.get("description"); + } + if (id == null) + throw new IllegalStateException("Illegal modpack id!"); + } + + if (MessageBox.Show(description, C.i18n("modpack.install.task"), MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION) + return; + File preVersion = new File(versions, id), preVersionRenamed = null; if (preVersion.exists()) { HMCLog.log("Backing up the game"); @@ -184,7 +220,7 @@ public final class ModpackManager { * * @throws IOException if create tmp directory failed */ - public static void export(File output, IMinecraftProvider provider, String version, List blacklist) throws IOException, GameException { + public static void export(File output, IMinecraftProvider provider, String version, List blacklist, Map modpackJson) throws IOException, GameException { final ArrayList b = new ArrayList<>(MODPACK_BLACK_LIST); if (blacklist != null) b.addAll(blacklist); @@ -211,6 +247,7 @@ public final class ModpackManager { mv.jar = r.version; mv.runDir = "version"; zip.putTextFile(C.GSON.toJson(mv), "minecraft/pack.json"); + zip.putTextFile(C.GSON.toJson(modpackJson), "modpack.json"); } finally { if (zip != null) zip.closeFile(); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftLibrary.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftLibrary.java index 83e7eece6..c7c4edc2e 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftLibrary.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftLibrary.java @@ -31,7 +31,8 @@ import org.jackhuang.hellominecraft.util.StrUtils; public class MinecraftLibrary extends IMinecraftLibrary { public ArrayList rules; - public String url, formatted = null; + public String url; + public transient String formatted = null; public Natives natives; public Extract extract; diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftVersionManager.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftVersionManager.java index 54a351a45..b937c7e5d 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftVersionManager.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/version/MinecraftVersionManager.java @@ -85,69 +85,67 @@ public class MinecraftVersionManager extends IMinecraftProvider { File version = new File(service.baseDirectory(), "versions"); File[] files = version.listFiles(); - if (files == null || files.length == 0) - return; + if (files != null && files.length > 0) + for (File dir : files) { + String id = dir.getName(); + File jsonFile = new File(dir, id + ".json"); - for (File dir : files) { - String id = dir.getName(); - File jsonFile = new File(dir, id + ".json"); - - if (!dir.isDirectory()) - continue; - boolean ask = false; - File[] jsons = null; - if (!jsonFile.exists()) { - jsons = FileUtils.searchSuffix(dir, "json"); - if (jsons.length == 1) - ask = true; - } - if (ask) { - HMCLog.warn("Found not matched filenames version: " + id + ", json: " + jsons[0].getName()); - if (MessageBox.Show(String.format(C.i18n("launcher.versions_json_not_matched"), id, jsons[0].getName()), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) - if (!jsons[0].renameTo(new File(jsons[0].getParent(), id + ".json"))) - HMCLog.warn("Failed to rename version json " + jsons[0]); - } - if (!jsonFile.exists()) { - if (MessageBox.Show(C.i18n("launcher.versions_json_not_matched_cannot_auto_completion", id), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) - FileUtils.deleteDirectoryQuietly(dir); - continue; - } - MinecraftVersion mcVersion; - try { - mcVersion = C.GSON.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class); - if (mcVersion == null) - throw new GameException("Wrong json format, got null."); - } catch (IOException | GameException e) { - HMCLog.warn("Found wrong format json, try to fix it.", e); - if (MessageBox.Show(C.i18n("launcher.versions_json_not_formatted", id), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) { - service.download().downloadMinecraftVersionJson(id); - try { - mcVersion = C.GSON.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class); - if (mcVersion == null) - throw new GameException("Wrong json format, got null."); - } catch (IOException | GameException ex) { - HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", ex); - continue; - } - } else + if (!dir.isDirectory()) continue; - } - try { - if (!id.equals(mcVersion.id)) { - HMCLog.warn("Found: " + dir + ", it contains id: " + mcVersion.id + ", expected: " + id + ", this app will fix this problem."); - mcVersion.id = id; - FileUtils.writeQuietly(jsonFile, C.GSON.toJson(mcVersion)); + boolean ask = false; + File[] jsons = null; + if (!jsonFile.exists()) { + jsons = FileUtils.searchSuffix(dir, "json"); + if (jsons.length == 1) + ask = true; } + if (ask) { + HMCLog.warn("Found not matched filenames version: " + id + ", json: " + jsons[0].getName()); + if (MessageBox.Show(String.format(C.i18n("launcher.versions_json_not_matched"), id, jsons[0].getName()), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) + if (!jsons[0].renameTo(new File(jsons[0].getParent(), id + ".json"))) + HMCLog.warn("Failed to rename version json " + jsons[0]); + } + if (!jsonFile.exists()) { + if (MessageBox.Show(C.i18n("launcher.versions_json_not_matched_cannot_auto_completion", id), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) + FileUtils.deleteDirectoryQuietly(dir); + continue; + } + MinecraftVersion mcVersion; + try { + mcVersion = C.GSON.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class); + if (mcVersion == null) + throw new GameException("Wrong json format, got null."); + } catch (IOException | GameException e) { + HMCLog.warn("Found wrong format json, try to fix it.", e); + if (MessageBox.Show(C.i18n("launcher.versions_json_not_formatted", id), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) { + service.download().downloadMinecraftVersionJson(id); + try { + mcVersion = C.GSON.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class); + if (mcVersion == null) + throw new GameException("Wrong json format, got null."); + } catch (IOException | GameException ex) { + HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", ex); + continue; + } + } else + continue; + } + try { + if (!id.equals(mcVersion.id)) { + HMCLog.warn("Found: " + dir + ", it contains id: " + mcVersion.id + ", expected: " + id + ", this app will fix this problem."); + mcVersion.id = id; + FileUtils.writeQuietly(jsonFile, C.GSON.toJson(mcVersion)); + } - if (mcVersion.libraries != null) - for (MinecraftLibrary ml : mcVersion.libraries) - ml.init(); - versions.put(id, mcVersion); - onLoadedVersion.execute(id); - } catch (Exception e) { - HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", e); + if (mcVersion.libraries != null) + for (MinecraftLibrary ml : mcVersion.libraries) + ml.init(); + versions.put(id, mcVersion); + onLoadedVersion.execute(id); + } catch (Exception e) { + HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", e); + } } - } onRefreshedVersions.execute(null); } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/DefaultMinecraftService.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/DefaultMinecraftService.java index 3afe04627..454ff890e 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/DefaultMinecraftService.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/DefaultMinecraftService.java @@ -35,8 +35,10 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftModService; import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftProvider; import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService; import org.jackhuang.hellominecraft.launcher.core.mod.MinecraftModService; +import org.jackhuang.hellominecraft.launcher.core.mod.ModpackManager; import org.jackhuang.hellominecraft.util.C; import org.jackhuang.hellominecraft.util.system.FileUtils; +import org.jackhuang.hellominecraft.util.tasks.TaskWindow; /** * @@ -52,6 +54,7 @@ public class DefaultMinecraftService extends IMinecraftService { this.provider = new HMCLGameProvider(this); provider.initializeMiencraft(); provider.onRefreshingVersions.register(versionSettings::clear); + provider.onRefreshedVersions.register(this::checkModpack); provider.onLoadedVersion.register(this::loadVersionSetting); this.mms = new MinecraftModService(this); this.mds = new MinecraftDownloadService(this); @@ -67,6 +70,14 @@ public class DefaultMinecraftService extends IMinecraftService { }); } + private void checkModpack() { + if (version().getVersionCount() == 0) { + File modpack = new File("modpack.zip"); + if (modpack.exists()) + TaskWindow.factory().append(ModpackManager.install(modpack, this, null)).create(); + } + } + private void loadVersionSetting(String id) { if (provider.getVersionById(id) == null) return; diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Profile.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Profile.java index 5c12c6561..da53c2895 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Profile.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Profile.java @@ -68,10 +68,9 @@ public final class Profile { private transient final VersionSetting defaultVersionSetting = new VersionSetting(); public VersionSetting getSelectedVersionSetting() { - String s = getSelectedVersion(); - VersionSetting vs = defaultVersionSetting; - if (s != null) - vs = getVersionSetting(getSelectedVersion()); + VersionSetting vs = getVersionSetting(getSelectedVersion()); + if (vs == null) + vs = defaultVersionSetting; return vs; } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.form b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.form new file mode 100644 index 000000000..f25f8d0a5 --- /dev/null +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.form @@ -0,0 +1,44 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.java new file mode 100644 index 000000000..9a535349c --- /dev/null +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackDescriptionPanel.java @@ -0,0 +1,84 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui + * + * 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 3 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. If not, see {http://www.gnu.org/licenses/}. + */ +package org.jackhuang.hellominecraft.launcher.ui.modpack; + +import java.util.Map; +import org.jackhuang.hellominecraft.util.ui.wizard.spi.WizardController; + +/** + * + * @author huangyuhui + */ +public class ModpackDescriptionPanel extends javax.swing.JPanel { + + public static final String KEY_MODPACK_DESCRITION = "modpackDescription"; + + private final transient WizardController controller; + private final Map wizardData; + + /** + * Creates new form ModpackDescriptionPanel + */ + public ModpackDescriptionPanel(WizardController controller, Map wizardData) { + initComponents(); + + this.controller = controller; + this.wizardData = wizardData; + } + + /** + * This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + txtDescription = new javax.swing.JTextPane(); + + txtDescription.addCaretListener(new javax.swing.event.CaretListener() { + public void caretUpdate(javax.swing.event.CaretEvent evt) { + txtDescriptionCaretUpdate(evt); + } + }); + jScrollPane1.setViewportView(txtDescription); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + + private void txtDescriptionCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtDescriptionCaretUpdate + wizardData.put(KEY_MODPACK_DESCRITION, txtDescription.getText()); + }//GEN-LAST:event_txtDescriptionCaretUpdate + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextPane txtDescription; + // End of variables declaration//GEN-END:variables +} diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.form b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.form index 41b159272..91cbf4fd5 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.form +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.form @@ -16,12 +16,13 @@ - + + - + @@ -30,8 +31,9 @@ + - + @@ -43,7 +45,11 @@ - + + + + + @@ -63,7 +69,7 @@ - + @@ -105,5 +111,20 @@ + + + + + + + + + + + + + + + diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.java index aa0a029c6..b2e016629 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackInitializationPanel.java @@ -32,6 +32,7 @@ public class ModpackInitializationPanel extends javax.swing.JPanel { public static final String KEY_GAME_VERSION = "gameVersion"; public static final String KEY_MODPACK_LOCATION = "modpackLocation"; + public static final String KEY_MODPACK_NAME = "modpackName"; private final transient WizardController controller; private final Map wizardData; @@ -73,6 +74,8 @@ public class ModpackInitializationPanel extends javax.swing.JPanel { lblGameVersion = new javax.swing.JLabel(); cboGameVersion = new javax.swing.JComboBox<>(); jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + txtModpackName = new javax.swing.JTextField(); lblModpackLocation.setText(C.i18n("modpack.save")); // NOI18N @@ -99,6 +102,15 @@ public class ModpackInitializationPanel extends javax.swing.JPanel { jLabel1.setText(C.i18n("modpack.warning")); // NOI18N + jLabel2.setText(C.i18n("modpack.name")); // NOI18N + + txtModpackName.setToolTipText(""); + txtModpackName.addCaretListener(new javax.swing.event.CaretListener() { + public void caretUpdate(javax.swing.event.CaretEvent evt) { + txtModpackNameCaretUpdate(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -106,25 +118,31 @@ public class ModpackInitializationPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txtModpackName) .addGroup(layout.createSequentialGroup() .addComponent(lblModpackLocation) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 353, Short.MAX_VALUE) .addComponent(cboModpackLocation)) .addComponent(txtModpackLocation) .addComponent(cboGameVersion, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblGameVersion) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(0, 67, Short.MAX_VALUE))) + .addComponent(jLabel1) + .addComponent(jLabel2)) + .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 120, Short.MAX_VALUE) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 70, Short.MAX_VALUE) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtModpackName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblModpackLocation) .addComponent(cboModpackLocation)) @@ -162,12 +180,23 @@ public class ModpackInitializationPanel extends javax.swing.JPanel { wizardData.put(KEY_GAME_VERSION, cboGameVersion.getSelectedItem()); }//GEN-LAST:event_cboGameVersionItemStateChanged + private void txtModpackNameCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtModpackNameCaretUpdate + wizardData.put(KEY_MODPACK_NAME, txtModpackName.getText()); + + if (txtModpackName.getText().trim().isEmpty()) + controller.setProblem(C.i18n("modpack.not_a_valid_name")); + else + controller.setProblem(null); + }//GEN-LAST:event_txtModpackNameCaretUpdate + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox cboGameVersion; private javax.swing.JButton cboModpackLocation; private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; private javax.swing.JLabel lblGameVersion; private javax.swing.JLabel lblModpackLocation; private javax.swing.JTextField txtModpackLocation; + private javax.swing.JTextField txtModpackName; // End of variables declaration//GEN-END:variables } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackWizard.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackWizard.java index adcbcbabb..59781e2ee 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackWizard.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackWizard.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -60,7 +61,7 @@ public class ModpackWizard extends WizardBranchController { } public ModpackWizard(IMinecraftService service) { - super(new WizardPanelProvider(C.i18n("modpack.wizard"), new String[] { C.i18n("modpack.wizard.step.1"), C.i18n("modpack.wizard.step.2") }, new String[] { C.i18n("modpack.wizard.step.1.title"), C.i18n("modpack.wizard.step.2.title") }) { + super(new WizardPanelProvider(C.i18n("modpack.wizard"), new String[] { C.i18n("modpack.wizard.step.1"), C.i18n("modpack.wizard.step.2"), C.i18n("modpack.wizard.step.3") }, new String[] { C.i18n("modpack.wizard.step.1.title"), C.i18n("modpack.wizard.step.2.title"), C.i18n("modpack.wizard.step.3.title") }) { @Override protected Object finish(Map settings) throws WizardException { @@ -71,12 +72,16 @@ public class ModpackWizard extends WizardBranchController { ArrayList blackList = new ArrayList<>(ModpackManager.MODPACK_BLACK_LIST); CheckBoxTreeNode root = (CheckBoxTreeNode) settings.get("blackList"); process(root, "minecraft", blackList); + HashMap map = new HashMap(); + map.put("name", (String) settings.get(ModpackInitializationPanel.KEY_MODPACK_NAME)); + if (settings.containsKey(ModpackDescriptionPanel.KEY_MODPACK_DESCRITION)) + map.put("description", (String) settings.get(ModpackDescriptionPanel.KEY_MODPACK_DESCRITION)); try { File loc = new File((String) settings.get(ModpackInitializationPanel.KEY_MODPACK_LOCATION)); ModpackManager.export(loc, service.version(), (String) settings.get(ModpackInitializationPanel.KEY_GAME_VERSION), - blackList); + blackList, map); progress.finished(new Summary(C.i18n("modpack.export_finished") + ": " + loc.getAbsolutePath(), null)); } catch (IOException | GameException ex) { HMCLog.err("Failed to export modpack", ex); @@ -99,9 +104,13 @@ public class ModpackWizard extends WizardBranchController { return new ModpackInitializationPanel(controller, settings, s); case 1: - controller.setForwardNavigationMode(WizardController.MODE_CAN_FINISH); + controller.setForwardNavigationMode(WizardController.MODE_CAN_CONTINUE_OR_FINISH); return new ModpackFileSelectionPanel(controller, settings, service.baseDirectory(), ModpackManager.MODPACK_PREDICATE); + case 2: + controller.setForwardNavigationMode(WizardController.MODE_CAN_FINISH); + + return new ModpackDescriptionPanel(controller, settings); default: throw new IllegalArgumentException(id); } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/CrashReporter.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/CrashReporter.java index 2583d2d99..ec14b61bd 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/CrashReporter.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/CrashReporter.java @@ -43,6 +43,24 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler { private static final Logger LOGGER = Logger.getLogger(CrashReporter.class.getName()); + private static final HashMap SOURCE = new HashMap() { + { + put("MessageBox", ""); + put("AWTError", ""); + put("JFileChooser", "Has your operating system been installed completely or is a ghost system? "); + put("JceSecurityManager", "Has your operating system been installed completely or is a ghost system? "); + put("sun.awt.shell.Win32ShellFolder2", "crash.user_fault"); + put("UnsatisfiedLinkError", "crash.user_fault"); + put("java.awt.HeadlessException", "crash.headless"); + put("java.lang.NoClassDefFoundError", "crash.NoClassDefFound"); + put("java.lang.VerifyError", "crash.NoClassDefFound"); + put("java.lang.NoSuchMethodError", "crash.NoClassDefFound"); + put("java.lang.IncompatibleClassChangeError", "crash.NoClassDefFound"); + put("java.lang.ClassFormatError", "crash.NoClassDefFound"); + put("java.lang.OutOfMemoryError", "FUCKING MEMORY LIMIT!"); + } + }; + boolean enableLogger = false; public CrashReporter(boolean enableLogger) { @@ -51,47 +69,26 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler { public boolean checkThrowable(Throwable e) { String s = StrUtils.getStackTrace(e); - if (s.contains("MessageBox") || s.contains("AWTError")) - return false; - else if (s.contains("JFileChooser") || s.contains("JceSecurityManager")) { - LOGGER.severe("Is not your operating system installed completely? "); - return false; - } - if (s.contains("sun.awt.shell.Win32ShellFolder2") || s.contains("UnsatisfiedLinkError")) { - LOGGER.severe(C.i18n("crash.user_fault")); - try { - showMessage(C.i18n("crash.user_fault")); - } catch (Throwable t) { - LOGGER.log(Level.SEVERE, "Failed to show message", t); + for (HashMap.Entry entry : SOURCE.entrySet()) + if (s.contains(entry.getKey())) { + if (StrUtils.isNotBlank(entry.getValue())) { + String info = C.i18n(entry.getKey()); + LOGGER.severe(info); + try { + showMessage(info); + } catch (Throwable t) { + LOGGER.log(Level.SEVERE, "Failed to show message", t); + } + } + return false; } - return false; - } else if (s.contains("java.awt.HeadlessException")) { - LOGGER.severe(C.i18n("crash.headless")); - try { - showMessage(C.i18n("crash.headless")); - } catch (Throwable t) { - LOGGER.log(Level.SEVERE, "Failed to show message", t); - } - return false; - } else if (s.contains("java.lang.NoClassDefFoundError") || s.contains("java.lang.VerifyError") || s.contains("java.lang.NoSuchMethodError") || s.contains("java.lang.IncompatibleClassChangeError") || s.contains("java.lang.ClassFormatError")) { - LOGGER.severe(C.i18n("crash.NoClassDefFound")); - try { - showMessage(C.i18n("crash.NoClassDefFound")); - } catch (Throwable t) { - LOGGER.log(Level.SEVERE, "Failed to show message", t); - } - return false; - } else if (s.contains("java.lang.OutOfMemoryError")) { - LOGGER.severe("FUCKING MEMORY LIMIT!"); - return false; - } return true; } @Override public void uncaughtException(Thread t, Throwable e) { String s = StrUtils.getStackTrace(e); - if (!s.contains("org.jackhuang.hellominecraft")) + if (!s.contains("org.jackhuang")) return; try { String text = "\n---- Hello Minecraft! Crash Report ----\n"; diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.form b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.form deleted file mode 100755 index aa46ef88a..000000000 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.form +++ /dev/null @@ -1,101 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.java deleted file mode 100755 index 0084bb88b..000000000 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/Selector.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Hello Minecraft!. - * Copyright (C) 2013 huangyuhui - * - * 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 3 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. If not, see {http://www.gnu.org/licenses/}. - */ -package org.jackhuang.hellominecraft.util.ui; - -import org.jackhuang.hellominecraft.util.C; - -/** - * The frame given to choose things. - * - * @author huangyuhui - */ -public class Selector extends javax.swing.JDialog { - - String[] selList; - String msg; - /** - * The index of the chosen in select list. - */ - public int sel; - public static final int FAILED_TO_SELECT = -1; - - /** - * @param parent null - * @param selList Selection List - * @param msg Message - */ - public Selector(java.awt.Frame parent, String[] selList, String msg) { - super(parent, true); - initComponents(); - - setLocationRelativeTo(null); - - this.selList = selList; - this.sel = FAILED_TO_SELECT; - this.msg = msg; - jLabel1.setText(msg); - for (String s : selList) - jComboBox1.addItem(s); - } - - public int getChoice() { - setVisible(true); - return sel; - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - jLabel1 = new javax.swing.JLabel(); - jComboBox1 = new javax.swing.JComboBox(); - btnOK = new javax.swing.JButton(); - btnCancel = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - jLabel1.setText(C.i18n("selector.choose")); // NOI18N - - btnOK.setText(C.i18n("button.ok")); // NOI18N - btnOK.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOKActionPerformed(evt); - } - }); - - btnCancel.setText(C.i18n("button.cancel")); // NOI18N - btnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel1) - .addGap(0, 0, Short.MAX_VALUE)))) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(212, Short.MAX_VALUE) - .addComponent(btnCancel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnOK) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnOK) - .addComponent(btnCancel)) - .addContainerGap()) - ); - - pack(); - }// //GEN-END:initComponents - - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed - sel = FAILED_TO_SELECT; - this.dispose(); - }//GEN-LAST:event_btnCancelActionPerformed - - private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed - sel = jComboBox1.getSelectedIndex(); - this.dispose(); - }//GEN-LAST:event_btnOKActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnCancel; - private javax.swing.JButton btnOK; - private javax.swing.JComboBox jComboBox1; - private javax.swing.JLabel jLabel1; - // End of variables declaration//GEN-END:variables -} diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/SwingUtils.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/SwingUtils.java index 1e96c8b55..f501c865e 100755 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/SwingUtils.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/ui/SwingUtils.java @@ -26,8 +26,10 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.swing.DefaultListModel; +import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JList; +import javax.swing.JOptionPane; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JTable; @@ -253,4 +255,14 @@ public class SwingUtils { r.run(); } } + + public static int select(String[] selList, String msg) { + Object msgs[] = new Object[2]; + msgs[0] = msg; + msgs[1] = new JComboBox(selList); + int result = JOptionPane.showOptionDialog(null, msgs, msg, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); + if (result == JOptionPane.CANCEL_OPTION) + return -1; + return ((JComboBox) msgs[1]).getSelectedIndex(); + } } diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.lang b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.lang index 895be1809..29d9c2852 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.lang +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.lang @@ -213,6 +213,7 @@ modpack=整合包 modpack.choose=选择要导入的游戏整合包文件,如果您希望更新整合包,请输入要更新的版本名 modpack.install.task=导入整合包 modpack.install_error=安装失败,可能是整合包格式不正确或操作文件失败 +modpack.install.will_install=将会安装整合包: modpack.save=选择要导出到的游戏整合包位置 modpack.save.task=导出整合包 modpack.export_error=导出失败,可能是您的游戏文件夹格式不正确或操作文件失败 @@ -223,11 +224,15 @@ modpack.wizard.step.1=基本设置 modpack.wizard.step.1.title=设置整合包的主要信息 modpack.wizard.step.2=文件选择 modpack.wizard.step.2.title=选中你不想加到整合包中的文件(夹) +modpack.wizard.step.3=整合包描述 +modpack.wizard.step.3.title=描述你要制作的整合包,比如整合包注意事项和更新记录,支持HTML 3。 modpack.incorrect_format.no_json=整合包格式错误,pack.json丢失 modpack.incorrect_format.no_jar=整合包格式错误,pack.json丢失jar字段 modpack.cannot_read_version=读取游戏版本失败 modpack.not_a_valid_location=不是一个有效整合包位置 modpack.warning=在制作整合包前,请您确认您选择的版本可以正常启动,
并保证您的Minecraft是正式版而非快照版,
而且不应当将不允许非官方途径传播的Mod纳入整合包。 +modpack.name=整合包名称 +modpack.not_a_valid_name=整合包名称不能为空 mods=Mod管理 mods.choose_mod=选择模组 @@ -353,7 +358,7 @@ color.red=红色 color.blue=蓝色 color.green=绿色 color.orange=橙色 -color.dark_blue=深蓝色失败 +color.dark_blue=深蓝色 color.purple=紫色 wizard.next_>=下一步 > @@ -373,4 +378,4 @@ wizard.failed=失败 wizard.steps=步骤 lang=简体中文 -lang.default=跟随系统语言 \ No newline at end of file +lang.default=跟随系统语言 diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.properties index 25de795f2..a8106a80c 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.properties @@ -213,6 +213,7 @@ modpack=\u6574\u5408\u5305 modpack.choose=\u9009\u62e9\u8981\u5bfc\u5165\u7684\u6e38\u620f\u6574\u5408\u5305\u6587\u4ef6\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u66f4\u65b0\u6574\u5408\u5305\uff0c\u8bf7\u8f93\u5165\u8981\u66f4\u65b0\u7684\u7248\u672c\u540d modpack.install.task=\u5bfc\u5165\u6574\u5408\u5305 modpack.install_error=\u5b89\u88c5\u5931\u8d25\uff0c\u53ef\u80fd\u662f\u6574\u5408\u5305\u683c\u5f0f\u4e0d\u6b63\u786e\u6216\u64cd\u4f5c\u6587\u4ef6\u5931\u8d25 +modpack.install.will_install=\u5c06\u4f1a\u5b89\u88c5\u6574\u5408\u5305\uff1a modpack.save=\u9009\u62e9\u8981\u5bfc\u51fa\u5230\u7684\u6e38\u620f\u6574\u5408\u5305\u4f4d\u7f6e modpack.save.task=\u5bfc\u51fa\u6574\u5408\u5305 modpack.export_error=\u5bfc\u51fa\u5931\u8d25\uff0c\u53ef\u80fd\u662f\u60a8\u7684\u6e38\u620f\u6587\u4ef6\u5939\u683c\u5f0f\u4e0d\u6b63\u786e\u6216\u64cd\u4f5c\u6587\u4ef6\u5931\u8d25 @@ -223,11 +224,15 @@ modpack.wizard.step.1=\u57fa\u672c\u8bbe\u7f6e modpack.wizard.step.1.title=\u8bbe\u7f6e\u6574\u5408\u5305\u7684\u4e3b\u8981\u4fe1\u606f modpack.wizard.step.2=\u6587\u4ef6\u9009\u62e9 modpack.wizard.step.2.title=\u9009\u4e2d\u4f60\u4e0d\u60f3\u52a0\u5230\u6574\u5408\u5305\u4e2d\u7684\u6587\u4ef6(\u5939) +modpack.wizard.step.3=\u6574\u5408\u5305\u63cf\u8ff0 +modpack.wizard.step.3.title=\u63cf\u8ff0\u4f60\u8981\u5236\u4f5c\u7684\u6574\u5408\u5305\uff0c\u6bd4\u5982\u6574\u5408\u5305\u6ce8\u610f\u4e8b\u9879\u548c\u66f4\u65b0\u8bb0\u5f55\uff0c\u652f\u6301HTML 3\u3002 modpack.incorrect_format.no_json=\u6574\u5408\u5305\u683c\u5f0f\u9519\u8bef\uff0cpack.json\u4e22\u5931 modpack.incorrect_format.no_jar=\u6574\u5408\u5305\u683c\u5f0f\u9519\u8bef\uff0cpack.json\u4e22\u5931jar\u5b57\u6bb5 modpack.cannot_read_version=\u8bfb\u53d6\u6e38\u620f\u7248\u672c\u5931\u8d25 modpack.not_a_valid_location=\u4e0d\u662f\u4e00\u4e2a\u6709\u6548\u6574\u5408\u5305\u4f4d\u7f6e modpack.warning=\u5728\u5236\u4f5c\u6574\u5408\u5305\u524d\uff0c\u8bf7\u60a8\u786e\u8ba4\u60a8\u9009\u62e9\u7684\u7248\u672c\u53ef\u4ee5\u6b63\u5e38\u542f\u52a8\uff0c
\u5e76\u4fdd\u8bc1\u60a8\u7684Minecraft\u662f\u6b63\u5f0f\u7248\u800c\u975e\u5feb\u7167\u7248\uff0c
\u800c\u4e14\u4e0d\u5e94\u5f53\u5c06\u4e0d\u5141\u8bb8\u975e\u5b98\u65b9\u9014\u5f84\u4f20\u64ad\u7684Mod\u7eb3\u5165\u6574\u5408\u5305\u3002 +modpack.name=\u6574\u5408\u5305\u540d\u79f0 +modpack.not_a_valid_name=\u6574\u5408\u5305\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a mods=Mod\u7ba1\u7406 mods.choose_mod=\u9009\u62e9\u6a21\u7ec4 @@ -353,7 +358,7 @@ color.red=\u7ea2\u8272 color.blue=\u84dd\u8272 color.green=\u7eff\u8272 color.orange=\u6a59\u8272 -color.dark_blue=\u6df1\u84dd\u8272\u5931\u8d25 +color.dark_blue=\u6df1\u84dd\u8272 color.purple=\u7d2b\u8272 wizard.next_>=\u4e0b\u4e00\u6b65 > @@ -373,4 +378,4 @@ wizard.failed=\u5931\u8d25 wizard.steps=\u6b65\u9aa4 lang=\u7b80\u4f53\u4e2d\u6587 -lang.default=\u8ddf\u968f\u7cfb\u7edf\u8bed\u8a00 \ No newline at end of file +lang.default=\u8ddf\u968f\u7cfb\u7edf\u8bed\u8a00 diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.lang b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.lang index 47613ad26..ce888dad1 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.lang +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.lang @@ -213,6 +213,7 @@ modpack=Mod pack modpack.choose=Choose a modpack zip file which you want to import. If you want to update the modpack, please enter the version you want to update. modpack.install.task=Import the modpack modpack.install_error=Failed to install the modpack, maybe the modpack file is incorrect or failed to manage files. +modpack.install.will_install=Will install the modpack: modpack.save=Choose a location which you want to export the game files to. modpack.save.task=Export the modpack modpack.export_error=Failed to export the modpack, maybe the format of your game directory is incorrect or failed to manage files. @@ -223,11 +224,15 @@ modpack.wizard.step.1=Basic options modpack.wizard.step.1.title=Set the basic options to the modpack. modpack.wizard.step.2=Files selection modpack.wizard.step.2.title=Choose the files you do not want to put in the modpack. +modpack.wizard.step.3=Description +modpack.wizard.step.3.title=Describe your modpack, including precautions, changlog, supporting HTML 3. modpack.incorrect_format.no_json=The format of the modpack is incorrect, pack.json is missing. modpack.incorrect_format.no_jar=The format of the modpack is incorrect, pack.json does not have attribute 'jar' modpack.cannot_read_version=Failed to gather the game version modpack.not_a_valid_location=Not a valid modpack location modpack.warning=Before making modpack, you should ensure that your game can launch successfully,
and that your Minecraft is release, not snapshot.
and that it is not allowed to add mods which is not allowed to distribute to the modpack. +modpack.name=Modpack Name +modpack.not_a_valid_name=Modpack Name cannot be empty. mods=Mods mods.choose_mod=Choose your mods diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.properties index d7d07f3fa..614b22308 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_en.properties @@ -213,6 +213,7 @@ modpack=Mod pack modpack.choose=Choose a modpack zip file which you want to import. If you want to update the modpack, please enter the version you want to update. modpack.install.task=Import the modpack modpack.install_error=Failed to install the modpack, maybe the modpack file is incorrect or failed to manage files. +modpack.install.will_install=Will install the modpack: modpack.save=Choose a location which you want to export the game files to. modpack.save.task=Export the modpack modpack.export_error=Failed to export the modpack, maybe the format of your game directory is incorrect or failed to manage files. @@ -223,11 +224,15 @@ modpack.wizard.step.1=Basic options modpack.wizard.step.1.title=Set the basic options to the modpack. modpack.wizard.step.2=Files selection modpack.wizard.step.2.title=Choose the files you do not want to put in the modpack. +modpack.wizard.step.3=Description +modpack.wizard.step.3.title=Describe your modpack, including precautions, changlog, supporting HTML 3. modpack.incorrect_format.no_json=The format of the modpack is incorrect, pack.json is missing. modpack.incorrect_format.no_jar=The format of the modpack is incorrect, pack.json does not have attribute 'jar' modpack.cannot_read_version=Failed to gather the game version modpack.not_a_valid_location=Not a valid modpack location modpack.warning=Before making modpack, you should ensure that your game can launch successfully,
and that your Minecraft is release, not snapshot.
and that it is not allowed to add mods which is not allowed to distribute to the modpack. +modpack.name=Modpack Name +modpack.not_a_valid_name=Modpack Name cannot be empty. mods=Mods mods.choose_mod=Choose your mods diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.lang b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.lang index 4b512c47d..29d9c2852 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.lang +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.lang @@ -201,8 +201,8 @@ settings.game_directory=游戏路径 settings.dimension=游戏窗口分辨率 settings.fullscreen=全屏 settings.update_version=更新版本文件 -settings.physical_memory=物理内存大小 settings.run_directory=运行路径(版本隔离) +settings.physical_memory=物理内存大小 settings.choose_javapath=选择Java路径 settings.default=默认 settings.custom=自定义 @@ -213,6 +213,7 @@ modpack=整合包 modpack.choose=选择要导入的游戏整合包文件,如果您希望更新整合包,请输入要更新的版本名 modpack.install.task=导入整合包 modpack.install_error=安装失败,可能是整合包格式不正确或操作文件失败 +modpack.install.will_install=将会安装整合包: modpack.save=选择要导出到的游戏整合包位置 modpack.save.task=导出整合包 modpack.export_error=导出失败,可能是您的游戏文件夹格式不正确或操作文件失败 @@ -223,11 +224,15 @@ modpack.wizard.step.1=基本设置 modpack.wizard.step.1.title=设置整合包的主要信息 modpack.wizard.step.2=文件选择 modpack.wizard.step.2.title=选中你不想加到整合包中的文件(夹) +modpack.wizard.step.3=整合包描述 +modpack.wizard.step.3.title=描述你要制作的整合包,比如整合包注意事项和更新记录,支持HTML 3。 modpack.incorrect_format.no_json=整合包格式错误,pack.json丢失 modpack.incorrect_format.no_jar=整合包格式错误,pack.json丢失jar字段 modpack.cannot_read_version=读取游戏版本失败 modpack.not_a_valid_location=不是一个有效整合包位置 modpack.warning=在制作整合包前,请您确认您选择的版本可以正常启动,
并保证您的Minecraft是正式版而非快照版,
而且不应当将不允许非官方途径传播的Mod纳入整合包。 +modpack.name=整合包名称 +modpack.not_a_valid_name=整合包名称不能为空 mods=Mod管理 mods.choose_mod=选择模组 @@ -373,4 +378,4 @@ wizard.failed=失败 wizard.steps=步骤 lang=简体中文 -lang.default=跟随系统语言 \ No newline at end of file +lang.default=跟随系统语言 diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.properties index aed1cc01d..a8106a80c 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_CN.properties @@ -201,8 +201,8 @@ settings.game_directory=\u6e38\u620f\u8def\u5f84 settings.dimension=\u6e38\u620f\u7a97\u53e3\u5206\u8fa8\u7387 settings.fullscreen=\u5168\u5c4f settings.update_version=\u66f4\u65b0\u7248\u672c\u6587\u4ef6 -settings.physical_memory=\u7269\u7406\u5185\u5b58\u5927\u5c0f settings.run_directory=\u8fd0\u884c\u8def\u5f84(\u7248\u672c\u9694\u79bb) +settings.physical_memory=\u7269\u7406\u5185\u5b58\u5927\u5c0f settings.choose_javapath=\u9009\u62e9Java\u8def\u5f84 settings.default=\u9ed8\u8ba4 settings.custom=\u81ea\u5b9a\u4e49 @@ -213,6 +213,7 @@ modpack=\u6574\u5408\u5305 modpack.choose=\u9009\u62e9\u8981\u5bfc\u5165\u7684\u6e38\u620f\u6574\u5408\u5305\u6587\u4ef6\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u66f4\u65b0\u6574\u5408\u5305\uff0c\u8bf7\u8f93\u5165\u8981\u66f4\u65b0\u7684\u7248\u672c\u540d modpack.install.task=\u5bfc\u5165\u6574\u5408\u5305 modpack.install_error=\u5b89\u88c5\u5931\u8d25\uff0c\u53ef\u80fd\u662f\u6574\u5408\u5305\u683c\u5f0f\u4e0d\u6b63\u786e\u6216\u64cd\u4f5c\u6587\u4ef6\u5931\u8d25 +modpack.install.will_install=\u5c06\u4f1a\u5b89\u88c5\u6574\u5408\u5305\uff1a modpack.save=\u9009\u62e9\u8981\u5bfc\u51fa\u5230\u7684\u6e38\u620f\u6574\u5408\u5305\u4f4d\u7f6e modpack.save.task=\u5bfc\u51fa\u6574\u5408\u5305 modpack.export_error=\u5bfc\u51fa\u5931\u8d25\uff0c\u53ef\u80fd\u662f\u60a8\u7684\u6e38\u620f\u6587\u4ef6\u5939\u683c\u5f0f\u4e0d\u6b63\u786e\u6216\u64cd\u4f5c\u6587\u4ef6\u5931\u8d25 @@ -223,11 +224,15 @@ modpack.wizard.step.1=\u57fa\u672c\u8bbe\u7f6e modpack.wizard.step.1.title=\u8bbe\u7f6e\u6574\u5408\u5305\u7684\u4e3b\u8981\u4fe1\u606f modpack.wizard.step.2=\u6587\u4ef6\u9009\u62e9 modpack.wizard.step.2.title=\u9009\u4e2d\u4f60\u4e0d\u60f3\u52a0\u5230\u6574\u5408\u5305\u4e2d\u7684\u6587\u4ef6(\u5939) +modpack.wizard.step.3=\u6574\u5408\u5305\u63cf\u8ff0 +modpack.wizard.step.3.title=\u63cf\u8ff0\u4f60\u8981\u5236\u4f5c\u7684\u6574\u5408\u5305\uff0c\u6bd4\u5982\u6574\u5408\u5305\u6ce8\u610f\u4e8b\u9879\u548c\u66f4\u65b0\u8bb0\u5f55\uff0c\u652f\u6301HTML 3\u3002 modpack.incorrect_format.no_json=\u6574\u5408\u5305\u683c\u5f0f\u9519\u8bef\uff0cpack.json\u4e22\u5931 modpack.incorrect_format.no_jar=\u6574\u5408\u5305\u683c\u5f0f\u9519\u8bef\uff0cpack.json\u4e22\u5931jar\u5b57\u6bb5 modpack.cannot_read_version=\u8bfb\u53d6\u6e38\u620f\u7248\u672c\u5931\u8d25 modpack.not_a_valid_location=\u4e0d\u662f\u4e00\u4e2a\u6709\u6548\u6574\u5408\u5305\u4f4d\u7f6e modpack.warning=\u5728\u5236\u4f5c\u6574\u5408\u5305\u524d\uff0c\u8bf7\u60a8\u786e\u8ba4\u60a8\u9009\u62e9\u7684\u7248\u672c\u53ef\u4ee5\u6b63\u5e38\u542f\u52a8\uff0c
\u5e76\u4fdd\u8bc1\u60a8\u7684Minecraft\u662f\u6b63\u5f0f\u7248\u800c\u975e\u5feb\u7167\u7248\uff0c
\u800c\u4e14\u4e0d\u5e94\u5f53\u5c06\u4e0d\u5141\u8bb8\u975e\u5b98\u65b9\u9014\u5f84\u4f20\u64ad\u7684Mod\u7eb3\u5165\u6574\u5408\u5305\u3002 +modpack.name=\u6574\u5408\u5305\u540d\u79f0 +modpack.not_a_valid_name=\u6574\u5408\u5305\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a mods=Mod\u7ba1\u7406 mods.choose_mod=\u9009\u62e9\u6a21\u7ec4 @@ -373,4 +378,4 @@ wizard.failed=\u5931\u8d25 wizard.steps=\u6b65\u9aa4 lang=\u7b80\u4f53\u4e2d\u6587 -lang.default=\u8ddf\u968f\u7cfb\u7edf\u8bed\u8a00 \ No newline at end of file +lang.default=\u8ddf\u968f\u7cfb\u7edf\u8bed\u8a00 diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.lang b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.lang index 03bdbd69c..6e0f1de8f 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.lang +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.lang @@ -210,9 +210,10 @@ settings.choose_gamedir=选择游戏路径 settings.failed_load=設定資料加載失敗,可能是升級了啟動器或被人工修改造成錯誤,是否清除? modpack=懶人包 -modpack.choose=選擇要導入的遊戲懶人包資料,如果您希望更新整合包,请输入要更新的版本名 +modpack.choose=選擇要導入的遊戲懶人包資料,如果您希望更新懶人包,请输入要更新的版本名 modpack.install.task=導入懶人包 -modpack.install_error=安裝失敗,可能是整合包格式不正確或操作資料失敗 +modpack.install_error=安裝失敗,可能是懶人包格式不正確或操作資料失敗 +modpack.install.will_install=將會安裝懶人包: modpack.save=選擇要導出到的遊戲懶人包位置 modpack.save.task=導出懶人包 modpack.export_error=導出失敗,可能是您的遊戲資料夾格式不正確或操作資料失敗 @@ -222,12 +223,16 @@ modpack.wizard=導出懶人包嚮導 modpack.wizard.step.1=基本設定 modpack.wizard.step.1.title=設置懶人包的主要信息 modpack.wizard.step.2=資料選擇 -modpack.wizard.step.2.title=選中你不想加到整合包中的資料(夾) +modpack.wizard.step.2.title=選中你不想加到懶人包中的資料(夾) +modpack.wizard.step.3=懶人包描述 +modpack.wizard.step.3.title=描述你要製作的懶人包,比如懶人包注意事項和更新記錄,支持HTML 3。 modpack.incorrect_format.no_json=懶人包格式錯誤,pack.json丟失 modpack.incorrect_format.no_jar=懶人包格式錯誤,pack.json丟失jar字段 modpack.cannot_read_version=讀取遊戲版本失敗 modpack.not_a_valid_location=不是一个有效懒人包位置 -modpack.warning=在製作整合包前,請您確認您選擇的版本可以正常啟動,​​
並保證您的Minecraft是正式版而非快照版,
而且不應當將不允許非官方途徑傳播的Mod納入整合包。 +modpack.warning=在製作懶人包前,請您確認您選擇的版本可以正常啟動,​​
並保證您的Minecraft是正式版而非快照版,
而且不應當將不允許非官方途徑傳播的Mod納入整合包。 +modpack.name=懶人包名稱 +modpack.not_a_valid_name=懶人包名稱不能為空 mods=Mod管理 mods.choose_mod=选择模组 diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.properties index a572d55f5..e13db6ebd 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N_zh_TW.properties @@ -210,9 +210,10 @@ settings.choose_gamedir=\u9009\u62e9\u6e38\u620f\u8def\u5f84 settings.failed_load=\u8a2d\u5b9a\u8cc7\u6599\u52a0\u8f09\u5931\u6557\uff0c\u53ef\u80fd\u662f\u5347\u7d1a\u4e86\u555f\u52d5\u5668\u6216\u88ab\u4eba\u5de5\u4fee\u6539\u9020\u6210\u932f\u8aa4\uff0c\u662f\u5426\u6e05\u9664\uff1f modpack=\u61f6\u4eba\u5305 -modpack.choose=\u9078\u64c7\u8981\u5c0e\u5165\u7684\u904a\u6232\u61f6\u4eba\u5305\u8cc7\u6599\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u66f4\u65b0\u6574\u5408\u5305\uff0c\u8bf7\u8f93\u5165\u8981\u66f4\u65b0\u7684\u7248\u672c\u540d +modpack.choose=\u9078\u64c7\u8981\u5c0e\u5165\u7684\u904a\u6232\u61f6\u4eba\u5305\u8cc7\u6599\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u66f4\u65b0\u61f6\u4eba\u5305\uff0c\u8bf7\u8f93\u5165\u8981\u66f4\u65b0\u7684\u7248\u672c\u540d modpack.install.task=\u5c0e\u5165\u61f6\u4eba\u5305 -modpack.install_error=\u5b89\u88dd\u5931\u6557\uff0c\u53ef\u80fd\u662f\u6574\u5408\u5305\u683c\u5f0f\u4e0d\u6b63\u78ba\u6216\u64cd\u4f5c\u8cc7\u6599\u5931\u6557 +modpack.install_error=\u5b89\u88dd\u5931\u6557\uff0c\u53ef\u80fd\u662f\u61f6\u4eba\u5305\u683c\u5f0f\u4e0d\u6b63\u78ba\u6216\u64cd\u4f5c\u8cc7\u6599\u5931\u6557 +modpack.install.will_install=\u5c07\u6703\u5b89\u88dd\u61f6\u4eba\u5305\uff1a modpack.save=\u9078\u64c7\u8981\u5c0e\u51fa\u5230\u7684\u904a\u6232\u61f6\u4eba\u5305\u4f4d\u7f6e modpack.save.task=\u5c0e\u51fa\u61f6\u4eba\u5305 modpack.export_error=\u5c0e\u51fa\u5931\u6557\uff0c\u53ef\u80fd\u662f\u60a8\u7684\u904a\u6232\u8cc7\u6599\u593e\u683c\u5f0f\u4e0d\u6b63\u78ba\u6216\u64cd\u4f5c\u8cc7\u6599\u5931\u6557 @@ -222,12 +223,16 @@ modpack.wizard=\u5c0e\u51fa\u61f6\u4eba\u5305\u56ae\u5c0e modpack.wizard.step.1=\u57fa\u672c\u8a2d\u5b9a modpack.wizard.step.1.title=\u8a2d\u7f6e\u61f6\u4eba\u5305\u7684\u4e3b\u8981\u4fe1\u606f modpack.wizard.step.2=\u8cc7\u6599\u9078\u64c7 -modpack.wizard.step.2.title=\u9078\u4e2d\u4f60\u4e0d\u60f3\u52a0\u5230\u6574\u5408\u5305\u4e2d\u7684\u8cc7\u6599(\u593e) +modpack.wizard.step.2.title=\u9078\u4e2d\u4f60\u4e0d\u60f3\u52a0\u5230\u61f6\u4eba\u5305\u4e2d\u7684\u8cc7\u6599(\u593e) +modpack.wizard.step.3=\u61f6\u4eba\u5305\u63cf\u8ff0 +modpack.wizard.step.3.title=\u63cf\u8ff0\u4f60\u8981\u88fd\u4f5c\u7684\u61f6\u4eba\u5305,\u6bd4\u5982\u61f6\u4eba\u5305\u6ce8\u610f\u4e8b\u9805\u548c\u66f4\u65b0\u8a18\u9304,\u652f\u6301HTML 3\u3002 modpack.incorrect_format.no_json=\u61f6\u4eba\u5305\u683c\u5f0f\u932f\u8aa4\uff0cpack.json\u4e1f\u5931 modpack.incorrect_format.no_jar=\u61f6\u4eba\u5305\u683c\u5f0f\u932f\u8aa4\uff0cpack.json\u4e1f\u5931jar\u5b57\u6bb5 modpack.cannot_read_version=\u8b80\u53d6\u904a\u6232\u7248\u672c\u5931\u6557 modpack.not_a_valid_location=\u4e0d\u662f\u4e00\u4e2a\u6709\u6548\u61d2\u4eba\u5305\u4f4d\u7f6e -modpack.warning=\u5728\u88fd\u4f5c\u6574\u5408\u5305\u524d,\u8acb\u60a8\u78ba\u8a8d\u60a8\u9078\u64c7\u7684\u7248\u672c\u53ef\u4ee5\u6b63\u5e38\u555f\u52d5,\u200b\u200b
\u4e26\u4fdd\u8b49\u60a8\u7684Minecraft\u662f\u6b63\u5f0f\u7248\u800c\u975e\u5feb\u7167\u7248,
\u800c\u4e14\u4e0d\u61c9\u7576\u5c07\u4e0d\u5141\u8a31\u975e\u5b98\u65b9\u9014\u5f91\u50b3\u64ad\u7684Mod\u7d0d\u5165\u6574\u5408\u5305\u3002 +modpack.warning=\u5728\u88fd\u4f5c\u61f6\u4eba\u5305\u524d,\u8acb\u60a8\u78ba\u8a8d\u60a8\u9078\u64c7\u7684\u7248\u672c\u53ef\u4ee5\u6b63\u5e38\u555f\u52d5,\u200b\u200b
\u4e26\u4fdd\u8b49\u60a8\u7684Minecraft\u662f\u6b63\u5f0f\u7248\u800c\u975e\u5feb\u7167\u7248,
\u800c\u4e14\u4e0d\u61c9\u7576\u5c07\u4e0d\u5141\u8a31\u975e\u5b98\u65b9\u9014\u5f91\u50b3\u64ad\u7684Mod\u7d0d\u5165\u6574\u5408\u5305\u3002 +modpack.name=\u61f6\u4eba\u5305\u540d\u7a31 +modpack.not_a_valid_name=\u61f6\u4eba\u5305\u540d\u7a31\u4e0d\u80fd\u70ba\u7a7a mods=Mod\u7ba1\u7406 mods.choose_mod=\u9009\u62e9\u6a21\u7ec4 diff --git a/common.gradle~ b/common.gradle~ new file mode 100755 index 000000000..946b9f18c --- /dev/null +++ b/common.gradle~ @@ -0,0 +1,81 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui + * + * 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 3 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. If not, see {http://www.gnu.org/licenses/}. + */ +apply plugin: 'java' +apply plugin: 'maven' +apply plugin: 'findbugs' + +//sourceCompatibility = '1.7' +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +repositories { + mavenCentral(); +} + +buildscript { + repositories { + mavenCentral(); + } +} + +dependencies { + // Adding dependencies here will add the dependencies to each subproject. + + compile 'com.google.code.gson:gson:2.2.4' // Apache License 2.0 +} + +task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') { + classifier = 'sources' + from sourceSets.main.allSource +} + +artifacts { + archives jar + archives sourcesJar +} + +task createFolders(description: 'Creates the source folders if they do not exist.') doLast { + sourceSets*.allSource*.srcDirs*.each { File srcDir -> + if (!srcDir.isDirectory()) { + println "Creating source folder: ${srcDir}" + srcDir.mkdirs() + } + } +} + +task makeExecutable(dependsOn: jar) << { + ext { + jar.classifier = '' + makeExecutableinjar = jar.archivePath + jar.classifier = '' + makeExecutableoutjar = jar.archivePath + jar.classifier = '' + } + def loc = new File(project.buildDir, "libs/" + makeExecutableoutjar.getName().substring(0, makeExecutableoutjar.getName().length()-4)+".exe") + def fos = new FileOutputStream(loc) + def is = new FileInputStream(new File(project.buildDir, '../HMCLauncher.exe')) + int read + def bytes = new byte[8192] + while((read = is.read(bytes)) != -1) + fos.write(bytes, 0, read); + is.close() + is = new FileInputStream(makeExecutableinjar) + while((read = is.read(bytes)) != -1) + fos.write(bytes, 0, read); + is.close() + fos.close() +} \ No newline at end of file