diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Main.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Main.java index 88276487a..a2bda5a4a 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Main.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Main.java @@ -123,6 +123,7 @@ public final class Main implements Runnable { return; System.setProperty("sun.java2d.noddraw", "true"); + System.setProperty("sun.java2d.apiaware", "false"); Thread.setDefaultUncaughtExceptionHandler(new CrashReporter(true)); try { diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/launch/GameLauncher.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/launch/GameLauncher.java index d099a5211..de7d8b053 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/launch/GameLauncher.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/core/launch/GameLauncher.java @@ -76,6 +76,7 @@ public class GameLauncher { } public IMinecraftLoader makeLaunchCommand() throws AuthenticationException, GameException { + HMCLog.log("Building process"); HMCLog.log("Logging in..."); IMinecraftLoader loader; if (info != null) @@ -131,7 +132,7 @@ public class GameLauncher { builder.redirectErrorStream(true).directory(service.version().getRunDirectory(options.getLaunchVersion())) .environment().put("APPDATA", service.baseDirectory().getAbsolutePath()); JavaProcess jp = new JavaProcess(str, builder.start(), PROCESS_MANAGER); - HMCLog.log("The game process have been started"); + HMCLog.log("Have started the process"); launchEvent.execute(jp); } 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 0274b8ac8..6a8eee7a2 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 @@ -39,6 +39,7 @@ 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.func.BiFunction; +import org.jackhuang.hellominecraft.util.func.CallbackIO; import org.jackhuang.hellominecraft.util.system.Compressor; import org.jackhuang.hellominecraft.util.system.FileUtils; import org.jackhuang.hellominecraft.util.system.ZipEngine; @@ -106,6 +107,8 @@ public final class ModpackManager { if (id == null) if (map.containsKey("name") && map.get("name") instanceof String) id = (String) map.get("name"); + if (id != null) + description += id; if (map.containsKey("description") && map.get("description") instanceof String) description += "\n" + (String) map.get("description"); } @@ -187,7 +190,7 @@ public final class ModpackManager { } - public static final List MODPACK_BLACK_LIST = Arrays.asList(new String[] { "usernamecache.json", "asm", "logs", "backups", "versions", "assets", "usercache.json", "libraries", "crash-reports", "launcher_profiles.json", "NVIDIA", "TCNodeTracker", "screenshots", "natives", "native", "$native", "hmclversion.cfg", "pack.json", "launcher.jar", "launcher.pack.lzma" }); + public static final List MODPACK_BLACK_LIST = Arrays.asList(new String[] { "usernamecache.json", "asm", "logs", "backups", "versions", "assets", "usercache.json", "libraries", "crash-reports", "launcher_profiles.json", "NVIDIA", "AMD", "TCNodeTracker", "screenshots", "natives", "native", "$native", "hmclversion.cfg", "pack.json", "launcher.jar", "launcher.pack.lzma", "hmclmc.log" }); public static final List MODPACK_SUGGESTED_BLACK_LIST = Arrays.asList(new String[] { "saves", "servers.dat", "options.txt", "optionsshaders.txt", "mods/VoxelMods" }); /** @@ -227,7 +230,7 @@ public final class ModpackManager { * * @throws IOException if create tmp directory failed */ - public static void export(File output, IMinecraftProvider provider, String version, List blacklist, Map modpackJson) throws IOException, GameException { + public static void export(File output, IMinecraftProvider provider, String version, List blacklist, Map modpackJson, CallbackIO callback) throws IOException, GameException { final ArrayList b = new ArrayList<>(MODPACK_BLACK_LIST); if (blacklist != null) b.addAll(blacklist); @@ -255,6 +258,8 @@ public final class ModpackManager { mv.runDir = "version"; zip.putTextFile(C.GSON.toJson(mv), "minecraft/pack.json"); zip.putTextFile(C.GSON.toJson(modpackJson), "modpack.json"); + if (callback != null) + callback.call(zip); } finally { if (zip != null) zip.closeFile(); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Config.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Config.java index ddf39f307..af5c8e996 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Config.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/setting/Config.java @@ -35,7 +35,7 @@ import org.jackhuang.hellominecraft.util.system.OS; * * @author huangyuhui */ -public final class Config { +public final class Config implements Cloneable { @SerializedName("last") private String last; @@ -56,6 +56,15 @@ public final class Config { private List java; @SerializedName("localization") private String localization; + @SerializedName("logintype") + private int logintype; + @SerializedName("downloadtype") + private int downloadtype; + @SerializedName("configurations") + private TreeMap configurations; + @SerializedName("auth") + @SuppressWarnings("FieldMayBeFinal") + private Map auth; public List getJava() { return java == null ? java = new ArrayList<>() : java; @@ -173,16 +182,6 @@ public final class Config { Settings.save(); } - @SerializedName("logintype") - private int logintype; - @SerializedName("downloadtype") - private int downloadtype; - @SerializedName("configurations") - private TreeMap configurations; - @SerializedName("auth") - @SuppressWarnings("FieldMayBeFinal") - private Map auth; - public Config() { clientToken = UUID.randomUUID().toString(); logintype = downloadtype = 0; @@ -245,4 +244,14 @@ public final class Config { this.localization = localization; Settings.save(); } + + @Override + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + throw new Error(e); + } + } + } 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 9b88d23ec..2e1d6a84d 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 @@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.launcher.setting; import org.jackhuang.hellominecraft.launcher.util.HMCLGameLauncher; -import org.jackhuang.hellominecraft.launcher.util.DefaultMinecraftService; +import org.jackhuang.hellominecraft.launcher.util.HMCLMinecraftService; import java.io.File; import org.jackhuang.hellominecraft.launcher.api.PluginManager; import org.jackhuang.hellominecraft.launcher.core.MCUtils; @@ -77,7 +77,7 @@ public final class Profile { } public VersionSetting getVersionSetting(String id) { - return ((DefaultMinecraftService) service()).getVersionSetting(id); + return ((HMCLMinecraftService) service()).getVersionSetting(id); } public String getSettingsSelectedMinecraftVersion() { diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/MainFrame.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/MainFrame.java index 678334625..35d27e336 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/MainFrame.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/MainFrame.java @@ -270,12 +270,13 @@ public final class MainFrame extends DraggableFrame { public void selectTab(String tabName) { int chosen = -1; + AnimatedPanel onCreate = null, onSelect = null; for (int i = 0; i < tabHeader.size(); i++) if (tabName.equalsIgnoreCase(tabHeader.get(i).getActionCommand())) { if (tabContent[i] == null) { try { tabContent[i] = tabClasses.get(i).newInstance(); - tabContent[i].onCreated(); + onCreate = tabContent[i]; } catch (Exception mustnothappen) { throw new Error(mustnothappen); } @@ -295,10 +296,14 @@ public final class MainFrame extends DraggableFrame { if (j != i) tabHeader.get(j).setIsActive(false); tabHeader.get(i).setIsActive(true); - tabContent[i].onSelected(); + onSelect = tabContent[i]; } this.infoLayout.show(this.infoSwap, tabName); + if (onCreate != null) + onCreate.onCreated(); + if (onSelect != null) + onSelect.onSelected(); } } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackFileSelectionPanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackFileSelectionPanel.java index adfbe4cf3..6aeb0b3a1 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackFileSelectionPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/ui/modpack/ModpackFileSelectionPanel.java @@ -76,6 +76,9 @@ public class ModpackFileSelectionPanel extends javax.swing.JPanel { put("minecraft/options.txt", C.i18n("modpack.files.options_txt")); put("minecraft/optionsshaders.txt", C.i18n("modpack.files.optionsshaders_txt")); put("minecraft/mods/VoxelMods", C.i18n("modpack.files.mods.voxelmods")); + put("minecraft/dumps", C.i18n("modpack.files.mods.dumps")); + put("minecraft/blueprints", C.i18n("modpack.files.mods.blueprints")); + put("minecraft/scripts", C.i18n("modpack.files.mods.scripts")); } }; 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 535219303..d7706ba68 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 @@ -19,6 +19,7 @@ package org.jackhuang.hellominecraft.launcher.ui.modpack; import java.util.Map; import java.util.Vector; +import java.util.regex.Pattern; import javax.swing.DefaultComboBoxModel; import javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; @@ -205,11 +206,13 @@ public class ModpackInitializationPanel extends javax.swing.JPanel { wizardData.put(KEY_INCLUDING_LAUNCHER, chkIncludeLauncher.isSelected()); }//GEN-LAST:event_chkIncludeLauncherItemStateChanged + static final Pattern PATTERN = Pattern.compile("[a-zA-Z0-9_u4e00-u9fa5]+$"); + void checkProblem() { controller.setProblem(null); if (txtModpackLocation.getText().trim().isEmpty()) controller.setProblem(C.i18n("modpack.not_a_valid_location")); - if (txtModpackName.getText().trim().isEmpty()) + if (!PATTERN.matcher(txtModpackName.getText()).matches()) controller.setProblem(C.i18n("modpack.not_a_valid_name")); } 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 2f68051d0..4b12a1167 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 @@ -30,13 +30,15 @@ import javax.swing.JComponent; import org.jackhuang.hellominecraft.launcher.core.GameException; import org.jackhuang.hellominecraft.launcher.core.mod.ModpackManager; import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion; +import org.jackhuang.hellominecraft.launcher.setting.Config; import org.jackhuang.hellominecraft.launcher.setting.Profile; +import org.jackhuang.hellominecraft.launcher.setting.Settings; import org.jackhuang.hellominecraft.util.C; import org.jackhuang.hellominecraft.util.Pair; import org.jackhuang.hellominecraft.util.StrUtils; import org.jackhuang.hellominecraft.util.Utils; +import org.jackhuang.hellominecraft.util.func.CallbackIO; import org.jackhuang.hellominecraft.util.logging.HMCLog; -import org.jackhuang.hellominecraft.util.system.FileUtils; import org.jackhuang.hellominecraft.util.system.ZipEngine; import org.jackhuang.hellominecraft.util.ui.WebPage; import org.jackhuang.hellominecraft.util.ui.checktree.CheckBoxTreeNode; @@ -103,13 +105,26 @@ public class ModpackWizard extends WizardBranchController { ModpackManager.export(modpack, profile.service().version(), (String) settings.get(ModpackInitializationPanel.KEY_GAME_VERSION), - blackList, map); + blackList, map, null); String summary = "" + C.i18n("modpack.export_finished") + ": " + loc.getAbsolutePath(); boolean including = false; if ((Boolean) settings.get(ModpackInitializationPanel.KEY_INCLUDING_LAUNCHER)) { boolean flag = true; ZipEngine engine = new ZipEngine(loc); + Config s = new Config(); + //s.setBgpath(Settings.getInstance().getBgpath()); + s.setDownloadType(Settings.getInstance().getDownloadType()); + engine.putTextFile(C.GSON.toJson(s), "hmcl.json"); engine.putFile(modpack, "modpack.zip"); + File bg = new File("bg"); + if (bg.isDirectory()) + engine.putDirectory(bg); + bg = new File("background.png"); + if (bg.isFile()) + engine.putFile(bg, "background.png"); + bg = new File("background.jpg"); + if (bg.isFile()) + engine.putFile(bg, "background.jpg"); for (URL u : Utils.getURL()) try { File f = new File(u.toURI()); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/DefaultPlugin.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/DefaultPlugin.java index 715edb750..51ab141cc 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/DefaultPlugin.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/DefaultPlugin.java @@ -43,7 +43,7 @@ public class DefaultPlugin implements IPlugin { @Override public IMinecraftService provideMinecraftService(Profile profile) { - return new DefaultMinecraftService(profile); + return new HMCLMinecraftService(profile); } @Override diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/HMCLGameProvider.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/HMCLGameProvider.java index f243d6053..852523de1 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/HMCLGameProvider.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/HMCLGameProvider.java @@ -28,17 +28,17 @@ import org.jackhuang.hellominecraft.launcher.setting.VersionSetting; */ public class HMCLGameProvider extends MinecraftVersionManager { - public HMCLGameProvider(DefaultMinecraftService p) { + public HMCLGameProvider(HMCLMinecraftService p) { super(p); } @Override public File getRunDirectory(String id) { - VersionSetting vs = ((DefaultMinecraftService) service).getVersionSetting(id); + VersionSetting vs = ((HMCLMinecraftService) service).getVersionSetting(id); if (vs == null) return super.getRunDirectory(id); else - return ((DefaultMinecraftService) service).getVersionSetting(id).getGameDirType() == GameDirType.VERSION_FOLDER + return ((HMCLMinecraftService) service).getVersionSetting(id).getGameDirType() == GameDirType.VERSION_FOLDER ? service.version().versionRoot(id) : super.getRunDirectory(id); } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/DefaultMinecraftService.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/HMCLMinecraftService.java similarity index 96% rename from HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/DefaultMinecraftService.java rename to HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/HMCLMinecraftService.java index ae88cb558..63c2ce433 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/DefaultMinecraftService.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/util/HMCLMinecraftService.java @@ -48,12 +48,12 @@ import org.jackhuang.hellominecraft.util.tasks.TaskWindow; * * @author huangyuhui */ -public class DefaultMinecraftService extends IMinecraftService { +public class HMCLMinecraftService extends IMinecraftService { Profile p; final Map versionSettings = new HashMap<>(); - public DefaultMinecraftService(Profile p) { + public HMCLMinecraftService(Profile p) { this.p = p; this.provider = new HMCLGameProvider(this); provider.initializeMiencraft(); @@ -69,8 +69,10 @@ public class DefaultMinecraftService extends IMinecraftService { private void checkModpack() { if (version().getVersionCount() == 0) { File modpack = new File("modpack.zip"); - if (modpack.exists()) + if (modpack.exists()) { TaskWindow.factory().append(ModpackManager.install(modpack, this, null)).create(); + version().refreshVersions(); + } } } diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/EventHandler.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/EventHandler.java index f803156bb..450976a16 100755 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/EventHandler.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/EventHandler.java @@ -17,7 +17,7 @@ */ package org.jackhuang.hellominecraft.util; -import java.util.HashSet; +import java.util.ArrayList; import org.jackhuang.hellominecraft.util.func.Consumer; /** @@ -27,9 +27,7 @@ import org.jackhuang.hellominecraft.util.func.Consumer; */ public class EventHandler { - HashSet> handlers = new HashSet<>(); - HashSet> consumers = new HashSet<>(); - HashSet runnables = new HashSet<>(); + ArrayList events = new ArrayList<>(); Object sender; public EventHandler(Object sender) { @@ -37,38 +35,42 @@ public class EventHandler { } public void register(Event t) { - handlers.add(t); + if (!events.contains(t)) + events.add(t); } public void register(Consumer t) { - consumers.add(t); + if (!events.contains(t)) + events.add(t); } public void register(Runnable t) { - runnables.add(t); + if (!events.contains(t)) + events.add(t); } public void unregister(Event t) { - handlers.remove(t); + events.remove(t); } public void unregister(Consumer t) { - consumers.remove(t); + events.remove(t); } public void unregister(Runnable t) { - runnables.remove(t); + events.remove(t); } public boolean execute(T x) { boolean flag = true; - for (Event t : handlers) - if (!t.call(sender, x)) - flag = false; - for (Consumer t : consumers) - t.accept(x); - for (Runnable t : runnables) - t.run(); + for (Object t : events) + if (t instanceof Event) { + if (!((Event) t).call(sender, x)) + flag = false; + } else if (t instanceof Consumer) + ((Consumer) t).accept(x); + else if (t instanceof Runnable) + ((Runnable) t).run(); return flag; } diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/func/CallbackIO.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/func/CallbackIO.java new file mode 100644 index 000000000..167c77660 --- /dev/null +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/func/CallbackIO.java @@ -0,0 +1,29 @@ +/* + * 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.util.func; + +import java.io.IOException; + +/** + * + * @author huangyuhui + */ +public interface CallbackIO { + + void call(T t) throws IOException; +} diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/JdkVersion.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/JdkVersion.java index 870e3471a..0a5e1c1ba 100755 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/JdkVersion.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/JdkVersion.java @@ -28,7 +28,7 @@ import org.jackhuang.hellominecraft.util.StrUtils; * * @author huangyuhui */ -public final class JdkVersion { +public final class JdkVersion implements Cloneable { private String ver; @@ -69,6 +69,15 @@ public final class JdkVersion { return location == null ? 0 : new File(location).hashCode(); } + @Override + protected Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException ex) { + throw new Error(ex); + } + } + public JdkVersion(String location) { File f = new File(location); if (f.exists() && f.isFile()) @@ -103,13 +112,13 @@ public final class JdkVersion { */ public static final int JAVA_19 = 6; - private static final String javaVersion; - private static final int majorJavaVersion; + private static final String JAVA_VER; + private static final int MAJOR_JAVA_VER; static { - javaVersion = System.getProperty("java.version"); + JAVA_VER = System.getProperty("java.version"); // version String should look like "1.4.2_10" - majorJavaVersion = parseVersion(javaVersion); + MAJOR_JAVA_VER = parseVersion(JAVA_VER); } private static int parseVersion(String javaVersion) { @@ -136,7 +145,7 @@ public final class JdkVersion { * @see System#getProperty(String) */ public static String getJavaVersion() { - return javaVersion; + return JAVA_VER; } /** @@ -155,7 +164,7 @@ public final class JdkVersion { * @see #JAVA_17 */ public static int getMajorJavaVersion() { - return majorJavaVersion; + return MAJOR_JAVA_VER; } public static boolean isJava64Bit() { diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/ZipEngine.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/ZipEngine.java index 46481ec07..76d655cc6 100644 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/ZipEngine.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/util/system/ZipEngine.java @@ -115,10 +115,11 @@ public class ZipEngine { public void putStream(InputStream is, String pathName) throws IOException { int length; - BufferedInputStream bis = new BufferedInputStream(is); - zos.putNextEntry(new ZipEntry(pathName)); - while ((length = bis.read(buf)) > 0) - zos.write(buf, 0, length); + try (BufferedInputStream bis = new BufferedInputStream(is)) { + zos.putNextEntry(new ZipEntry(pathName)); + while ((length = bis.read(buf)) > 0) + zos.write(buf, 0, length); + } } public void putTextFile(String text, String pathName) throws IOException { 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 1b85fb90b..2ef580cf9 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.lang +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.lang @@ -236,9 +236,9 @@ 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=整合包名称不能为空 +modpack.not_a_valid_name=不是一个有效的整合包名称 modpack.files.servers_dat=多人游戏服务器列表 modpack.files.saves=游戏存档 @@ -249,6 +249,9 @@ modpack.files.resourcepacks=资源包(材质包) modpack.files.options_txt=游戏设定 modpack.files.optionsshaders_txt=光影设定 modpack.files.mods.voxelmods=VoxelMods配置,如小地图 +modpack.files.dumps=NEI调试输出 +modpack.files.scripts=MineTweaker配置 +modpack.files.blueprints=BuildCraft蓝图 mods=Mod管理 mods.choose_mod=选择模组 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 defe65308..22c2f5bcb 100755 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang/I18N.properties @@ -236,9 +236,9 @@ modpack.incorrect_format.no_json=\u6574\u5408\u5305\u683c\u5f0f\u9519\u8bef\uff0 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\u3001\u6750\u8d28\u5305\u7b49\u7eb3\u5165\u6574\u5408\u5305\u3002 +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\u3001\u6750\u8d28\u5305\u7b49\u7eb3\u5165\u6574\u5408\u5305\u3002
\u6574\u5408\u5305\u4f1a\u4fdd\u5b58\u60a8\u76ee\u524d\u7684\u4e0b\u8f7d\u6e90\u8bbe\u7f6e modpack.name=\u6574\u5408\u5305\u540d\u79f0 -modpack.not_a_valid_name=\u6574\u5408\u5305\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a +modpack.not_a_valid_name=\u4e0d\u662f\u4e00\u4e2a\u6709\u6548\u7684\u6574\u5408\u5305\u540d\u79f0 modpack.files.servers_dat=\u591a\u4eba\u6e38\u620f\u670d\u52a1\u5668\u5217\u8868 modpack.files.saves=\u6e38\u620f\u5b58\u6863 @@ -249,6 +249,9 @@ modpack.files.resourcepacks=\u8d44\u6e90\u5305(\u6750\u8d28\u5305) modpack.files.options_txt=\u6e38\u620f\u8bbe\u5b9a modpack.files.optionsshaders_txt=\u5149\u5f71\u8bbe\u5b9a modpack.files.mods.voxelmods=VoxelMods\u914d\u7f6e\uff0c\u5982\u5c0f\u5730\u56fe +modpack.files.dumps=NEI\u8c03\u8bd5\u8f93\u51fa +modpack.files.scripts=MineTweaker\u914d\u7f6e +modpack.files.blueprints=BuildCraft\u84dd\u56fe mods=Mod\u7ba1\u7406 mods.choose_mod=\u9009\u62e9\u6a21\u7ec4 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 0337a4ddb..da414ac5d 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 @@ -238,17 +238,20 @@ 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. +modpack.not_a_valid_name=Not a valid modpack name modpack.files.servers_dat=Multiplayer servers list modpack.files.saves=Saved games modpack.files.mods=Mods -modpack.files.config=Mod configurations +modpack.files.config=Mod configs modpack.files.liteconfig=Mod configurations modpack.files.resourcepacks=Resource(Texutre) packs modpack.files.options_txt=Game options modpack.files.optionsshaders_txt=Shaders options modpack.files.mods.voxelmods=VoxelMods(including VoxelMap) options +modpack.files.dumps=NEI debug output +modpack.files.scripts=MineTweaker configs +modpack.files.blueprints=BuildCraft blueprints 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 f1a44050a..79d0abe49 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 @@ -238,17 +238,20 @@ 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. +modpack.not_a_valid_name=Not a valid modpack name modpack.files.servers_dat=Multiplayer servers list modpack.files.saves=Saved games modpack.files.mods=Mods -modpack.files.config=Mod configurations +modpack.files.config=Mod configs modpack.files.liteconfig=Mod configurations modpack.files.resourcepacks=Resource(Texutre) packs modpack.files.options_txt=Game options modpack.files.optionsshaders_txt=Shaders options modpack.files.mods.voxelmods=VoxelMods(including VoxelMap) options +modpack.files.dumps=NEI debug output +modpack.files.scripts=MineTweaker configs +modpack.files.blueprints=BuildCraft blueprints mods=Mods mods.choose_mod=Choose your mods 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 08dc12d42..25bfb45ce 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 @@ -236,9 +236,9 @@ 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=懶人包名稱不能為空 +modpack.not_a_valid_name=不是一个有效的懶人包名稱 modpack.files.servers_dat=多人遊戲伺服器列表 modpack.files.saves=遊戲存檔 @@ -249,6 +249,9 @@ modpack.files.resourcepacks=資源包(材質包) modpack.files.options_txt=遊戲設定 modpack.files.optionsshaders_txt=光影設定 modpack.files.mods.voxelmods=VoxelMods設定,如小地圖 +modpack.files.dumps=NEI調試輸出 +modpack.files.scripts=MineTweaker配置 +modpack.files.blueprints=BuildCraft藍圖 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 cb6081a11..86c39c85d 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 @@ -236,9 +236,9 @@ modpack.incorrect_format.no_json=\u61f6\u4eba\u5305\u683c\u5f0f\u932f\u8aa4\uff0 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\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\u3001\u6750\u8cea\u5305\u7b49\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,
\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\u3001\u6750\u8cea\u5305\u7b49\u7d0d\u5165\u6574\u5408\u5305\u3002
\u61f6\u4eba\u5305\u6703\u4fdd\u5b58\u60a8\u76ee\u524d\u7684\u4e0b\u8f09\u6e90\u8a2d\u5b9a modpack.name=\u61f6\u4eba\u5305\u540d\u7a31 -modpack.not_a_valid_name=\u61f6\u4eba\u5305\u540d\u7a31\u4e0d\u80fd\u70ba\u7a7a +modpack.not_a_valid_name=\u4e0d\u662f\u4e00\u4e2a\u6709\u6548\u7684\u61f6\u4eba\u5305\u540d\u7a31 modpack.files.servers_dat=\u591a\u4eba\u904a\u6232\u4f3a\u670d\u5668\u5217\u8868 modpack.files.saves=\u904a\u6232\u5b58\u6a94 @@ -249,6 +249,9 @@ modpack.files.resourcepacks=\u8cc7\u6e90\u5305(\u6750\u8cea\u5305) modpack.files.options_txt=\u904a\u6232\u8a2d\u5b9a modpack.files.optionsshaders_txt=\u5149\u5f71\u8a2d\u5b9a modpack.files.mods.voxelmods=VoxelMods\u8a2d\u5b9a\uff0c\u5982\u5c0f\u5730\u5716 +modpack.files.dumps=NEI\u8abf\u8a66\u8f38\u51fa +modpack.files.scripts=MineTweaker\u914d\u7f6e +modpack.files.blueprints=BuildCraft\u85cd\u5716 mods=Mod\u7ba1\u7406 mods.choose_mod=\u9009\u62e9\u6a21\u7ec4 diff --git a/MetroLookAndFeel/src/main/java/org/jackhuang/hellominecraft/lookandfeel/HelloMinecraftLookAndFeel.java b/MetroLookAndFeel/src/main/java/org/jackhuang/hellominecraft/lookandfeel/HelloMinecraftLookAndFeel.java index 6af6582f6..868d39df8 100755 --- a/MetroLookAndFeel/src/main/java/org/jackhuang/hellominecraft/lookandfeel/HelloMinecraftLookAndFeel.java +++ b/MetroLookAndFeel/src/main/java/org/jackhuang/hellominecraft/lookandfeel/HelloMinecraftLookAndFeel.java @@ -51,7 +51,11 @@ public class HelloMinecraftLookAndFeel extends SynthLookAndFeel { load(new ByteArrayInputStream(s.getBytes("UTF-8")), HelloMinecraftLookAndFeel.class); } catch (Throwable ex) { HMCLog.err("This fucking exception should not happen. Retry backup solution.", ex); - load(HelloMinecraftLookAndFeel.class.getResourceAsStream("/org/jackhuang/hellominecraft/lookandfeel/synth_backup.xml"), HelloMinecraftLookAndFeel.class); + try { + load(HelloMinecraftLookAndFeel.class.getResourceAsStream("/org/jackhuang/hellominecraft/lookandfeel/synth_backup.xml"), HelloMinecraftLookAndFeel.class); + } catch (Throwable e) { + HMCLog.err("User fault", e); + } } } diff --git a/common.gradle b/common.gradle index 1f42145e5..ebd79ae09 100755 --- a/common.gradle +++ b/common.gradle @@ -104,7 +104,7 @@ task makePackGZ(dependsOn: jar) << { messageDigest.update(buf, 0, bytesRead); } def sha1Hex = new BigInteger(1, messageDigest.digest()).toString(16).padLeft(40, '0') - def fileEx = new File(project.buildDir, "libs/" + makeExecutableoutjar.getName().substring(0, makeExecutableoutjar.getName().length()-4)+".sha1") + def fileEx = new File(project.buildDir, "libs/" + makeExecutableoutjar.getName().substring(0, makeExecutableoutjar.getName().length()-4)+".pack.gz.sha1") if (!fileEx.exists()) fileEx.createNewFile() fileEx.append sha1Hex }