Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0870f42557 | ||
|
|
85237eac7e | ||
|
|
8d5088d2e4 | ||
|
|
47f5bf1ea5 | ||
|
|
deebadef3a | ||
|
|
ce24ae4fae | ||
|
|
16152de39d | ||
|
|
4a2ac63d25 | ||
|
|
5437968c83 |
No files matched your search
+3
-3
@@ -29,7 +29,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.AssetIndexDownloadInfo;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.func.Function;
|
||||
import org.jackhuang.hellominecraft.util.func.BiFunction;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||
import org.jackhuang.hellominecraft.util.tasks.TaskWindow;
|
||||
@@ -209,8 +209,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
return virtualRoot;
|
||||
}
|
||||
|
||||
public final Function<MinecraftVersion, String> ASSET_PROVIDER_IMPL = t -> {
|
||||
if (!checkAssetsExistance(t.getAssetsIndex()))
|
||||
public final BiFunction<MinecraftVersion, Boolean, String> ASSET_PROVIDER_IMPL = (t, allow) -> {
|
||||
if (allow && !checkAssetsExistance(t.getAssetsIndex()))
|
||||
if (MessageBox.Show(C.i18n("assets.no_assets"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION)
|
||||
TaskWindow.execute(downloadAssets(t));
|
||||
return reconstructAssets(t.getAssetsIndex()).getAbsolutePath();
|
||||
|
||||
+2
-1
@@ -96,7 +96,8 @@ public abstract class IAuthenticator {
|
||||
public void onLoadSettings(Map m) {
|
||||
if (m == null)
|
||||
return;
|
||||
username = (String) m.get("IAuthenticator_UserName");
|
||||
Object o = m.get("IAuthenticator_UserName");
|
||||
username = o instanceof String ? (String) o : "";
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
|
||||
+1
-1
@@ -29,6 +29,6 @@ public class MinecraftRemoteVersion {
|
||||
public String getUrl(DownloadType type) {
|
||||
if (url == null)
|
||||
return type.getProvider().getVersionsDownloadURL() + id + "/" + id + ".json";
|
||||
return url;
|
||||
return type.getProvider().getParsedDownloadURL(url);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class MojangDownloadProvider extends IDownloadProvider {
|
||||
|
||||
@Override
|
||||
public String getAssetsDownloadURL() {
|
||||
return "http://resources.download.minecraft.net/";
|
||||
return "https://resources.download.minecraft.net/";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-3
@@ -29,6 +29,7 @@ import org.jackhuang.hellominecraft.launcher.core.install.optifine.vanilla.OptiF
|
||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||
import org.jackhuang.hellominecraft.util.tasks.download.FileDownloadTask;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.tasks.DeleteFileTask;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -61,7 +62,8 @@ public final class MinecraftInstallerService extends IMinecraftInstallerService
|
||||
return null;
|
||||
else
|
||||
return new FileDownloadTask(service.getDownloadType().getProvider().getParsedDownloadURL(v.installer), filepath).setTag("forge")
|
||||
.after(new ForgeInstaller(service, filepath));
|
||||
.after(new ForgeInstaller(service, filepath))
|
||||
.after(new DeleteFileTask(filepath));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,13 +73,15 @@ public final class MinecraftInstallerService extends IMinecraftInstallerService
|
||||
return null;
|
||||
OptiFineDownloadFormatter task = new OptiFineDownloadFormatter(v.installer);
|
||||
return task.after(new FileDownloadTask(filepath).registerPreviousResult(task).setTag("optifine"))
|
||||
.after(new OptiFineInstaller(service, installId, v, filepath));
|
||||
.after(new OptiFineInstaller(service, installId, v, filepath))
|
||||
.after(new DeleteFileTask(filepath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Task downloadLiteLoader(String installId, InstallerVersion v) {
|
||||
File filepath = IOUtils.tryGetCanonicalFile(IOUtils.currentDirWithSeparator() + "liteloader-universal.jar");
|
||||
FileDownloadTask task = (FileDownloadTask) new FileDownloadTask(v.universal, filepath).setTag("LiteLoader");
|
||||
return task.after(new LiteLoaderInstaller(service, installId, (LiteLoaderVersionList.LiteLoaderInstallerVersion) v).registerPreviousResult(task));
|
||||
return task.after(new LiteLoaderInstaller(service, installId, (LiteLoaderVersionList.LiteLoaderInstallerVersion) v).registerPreviousResult(task))
|
||||
.after(new DeleteFileTask(filepath));
|
||||
}
|
||||
}
|
||||
+8
-4
@@ -96,10 +96,12 @@ public class GameLauncher {
|
||||
if (file != null)
|
||||
FileUtils.cleanDirectoryQuietly(file);
|
||||
|
||||
HMCLog.log("Detecting libraries...");
|
||||
launchingStateChangedEvent.execute(LaunchingState.DownloadingLibraries);
|
||||
if (!downloadLibrariesEvent.execute(service.download().getDownloadLibraries(loader.getMinecraftVersion())))
|
||||
throw new GameException("Failed to download libraries");
|
||||
if (!options.isNotCheckGame()) {
|
||||
HMCLog.log("Detecting libraries...");
|
||||
launchingStateChangedEvent.execute(LaunchingState.DownloadingLibraries);
|
||||
if (!downloadLibrariesEvent.execute(service.download().getDownloadLibraries(loader.getMinecraftVersion())))
|
||||
throw new GameException("Failed to download libraries");
|
||||
}
|
||||
|
||||
HMCLog.log("Unpacking natives...");
|
||||
launchingStateChangedEvent.execute(LaunchingState.DecompressingNatives);
|
||||
@@ -172,6 +174,8 @@ public class GameLauncher {
|
||||
if (appdata != null) {
|
||||
writer.write("set appdata=" + appdata);
|
||||
writer.newLine();
|
||||
writer.write("cd %appdata%");
|
||||
writer.newLine();
|
||||
}
|
||||
}
|
||||
if (StrUtils.isNotBlank(options.getPrecalledCommand())) {
|
||||
|
||||
+9
-1
@@ -30,7 +30,7 @@ public class LaunchOptions {
|
||||
|
||||
private String name, versionName, javaArgs, minecraftArgs, maxMemory, permSize, width, height, serverIp, wrapper;
|
||||
private String proxyHost, proxyPort, proxyUser, proxyPass, javaDir, launchVersion, type, precalledCommand;
|
||||
private boolean fullscreen, noJVMArgs;
|
||||
private boolean fullscreen, noJVMArgs, notCheckGame;
|
||||
private JdkVersion java;
|
||||
private File gameDir;
|
||||
private GameDirType gameDirType;
|
||||
@@ -222,4 +222,12 @@ public class LaunchOptions {
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isNotCheckGame() {
|
||||
return notCheckGame;
|
||||
}
|
||||
|
||||
public void setNotCheckGame(boolean notCheckGame) {
|
||||
this.notCheckGame = notCheckGame;
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -21,7 +21,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.func.Function;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.OS;
|
||||
@@ -30,6 +29,7 @@ import org.jackhuang.hellominecraft.launcher.core.auth.UserProfileProvider;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftLibrary;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.util.func.BiFunction;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -57,7 +57,7 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
||||
|
||||
String[] splitted = StrUtils.tokenize(version.minecraftArguments);
|
||||
|
||||
String game_assets = assetProvider.apply(version);
|
||||
String game_assets = assetProvider.apply(version, !options.isNotCheckGame());
|
||||
|
||||
for (String t : splitted) {
|
||||
t = t.replace("${auth_player_name}", lr.getUserName());
|
||||
@@ -96,13 +96,13 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private final Function<MinecraftVersion, String> DEFAULT_ASSET_PROVIDER = t -> {
|
||||
private final BiFunction<MinecraftVersion, Boolean, String> DEFAULT_ASSET_PROVIDER = (t, allow) -> {
|
||||
return new File(service.baseDirectory(), "assets").getAbsolutePath();
|
||||
};
|
||||
|
||||
private Function<MinecraftVersion, String> assetProvider = DEFAULT_ASSET_PROVIDER;
|
||||
private BiFunction<MinecraftVersion, Boolean, String> assetProvider = DEFAULT_ASSET_PROVIDER;
|
||||
|
||||
public void setAssetProvider(Function<MinecraftVersion, String> assetProvider) {
|
||||
public void setAssetProvider(BiFunction<MinecraftVersion, Boolean, String> assetProvider) {
|
||||
if (assetProvider == null)
|
||||
this.assetProvider = DEFAULT_ASSET_PROVIDER;
|
||||
else
|
||||
|
||||
+2
-1
@@ -19,6 +19,7 @@ package org.jackhuang.hellominecraft.launcher.core.version;
|
||||
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -38,7 +39,7 @@ public class LibraryDownloadInfo extends GameDownloadInfo {
|
||||
if (path == null)
|
||||
return null;
|
||||
else
|
||||
myURL += path.replace('\\', '/');
|
||||
myURL = IOUtils.addURLSeparator(myURL) + path.replace('\\', '/');
|
||||
return myURL;
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,8 @@ public final class Config implements Cloneable {
|
||||
public transient final EventHandler<IAuthenticator> authChangedEvent = new EventHandler<>(this);
|
||||
|
||||
public Theme getTheme() {
|
||||
if (theme >= Theme.values().length)
|
||||
theme = 0;
|
||||
return Theme.values()[theme];
|
||||
}
|
||||
|
||||
|
||||
+11
-1
@@ -41,7 +41,7 @@ public class VersionSetting {
|
||||
|
||||
private String javaArgs, minecraftArgs, maxMemory, permSize, width, height;
|
||||
private String javaDir, precalledCommand, serverIp, java, wrapper;
|
||||
private boolean fullscreen, noJVMArgs;
|
||||
private boolean fullscreen, noJVMArgs, notCheckGame;
|
||||
|
||||
/**
|
||||
* 0 - Close the launcher when the game starts.<br/>
|
||||
@@ -265,6 +265,15 @@ public class VersionSetting {
|
||||
propertyChanged.execute("serverIp");
|
||||
}
|
||||
|
||||
public boolean isNotCheckGame() {
|
||||
return notCheckGame;
|
||||
}
|
||||
|
||||
public void setNotCheckGame(boolean notCheckGame) {
|
||||
this.notCheckGame = notCheckGame;
|
||||
propertyChanged.execute("notCheckGame");
|
||||
}
|
||||
|
||||
public LaunchOptions createLaunchOptions(File gameDir) {
|
||||
LaunchOptions x = new LaunchOptions();
|
||||
x.setFullscreen(isFullscreen());
|
||||
@@ -280,6 +289,7 @@ public class VersionSetting {
|
||||
x.setType(Main.shortTitle());
|
||||
x.setVersionName(Main.shortTitle());
|
||||
x.setNoJVMArgs(isNoJVMArgs());
|
||||
x.setNotCheckGame(isNotCheckGame());
|
||||
x.setPermSize(getPermSize());
|
||||
x.setPrecalledCommand(getPrecalledCommand());
|
||||
x.setProxyHost(Settings.getInstance().getProxyHost());
|
||||
|
||||
+38
-23
@@ -42,7 +42,7 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="916" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="577" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -63,7 +63,7 @@
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="576" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="447" max="32767" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -122,7 +122,7 @@
|
||||
<Component id="lblDimensionX" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtHeight" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="402" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="63" max="32767" attributes="0"/>
|
||||
<Component id="chkFullscreen" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
@@ -195,7 +195,7 @@
|
||||
<Component id="lblDimension" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtWidth" alignment="3" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="228" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="99" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnDownloadAllAssets" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnCleanGame" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@@ -388,16 +388,6 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtWrapperLauncher" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPrecalledCommand1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="txtPrecalledCommand" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="txtServerIP" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
@@ -408,21 +398,33 @@
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtJavaArgs" pref="664" max="32767" attributes="0"/>
|
||||
<Component id="txtJavaArgs" pref="325" max="32767" attributes="0"/>
|
||||
<Component id="txtMinecraftArgs" max="32767" attributes="0"/>
|
||||
<Component id="txtPermSize" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblPrecalledCommand" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblServerIP" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtWrapperLauncher" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPrecalledCommand1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="chkDontCheckGame" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblPrecalledCommand" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblServerIP" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -456,8 +458,11 @@
|
||||
<Component id="lblServerIP" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtServerIP" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="168" max="32767" attributes="0"/>
|
||||
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="39" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="chkNoJVMArgs" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkDontCheckGame" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -551,6 +556,16 @@
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="txtWrapperLauncherFocusLost"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkDontCheckGame">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/lang/I18N.properties" key="advancedsettings.dont_check_game_completeness" replaceFormat="C.i18n("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="chkDontCheckGameItemStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="pnlModManagement">
|
||||
@@ -586,7 +601,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jScrollPane1" pref="889" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="550" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="btnRemoveMod" max="32767" attributes="0"/>
|
||||
@@ -594,7 +609,7 @@
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="lblModInfo" pref="985" max="32767" attributes="0"/>
|
||||
<Component id="lblModInfo" pref="646" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -609,7 +624,7 @@
|
||||
<Component id="btnRemoveMod" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane1" pref="428" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="299" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblModInfo" min="-2" max="-2" attributes="0"/>
|
||||
|
||||
+54
-37
@@ -292,6 +292,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
txtServerIP = new javax.swing.JTextField();
|
||||
lblPrecalledCommand1 = new javax.swing.JLabel();
|
||||
txtWrapperLauncher = new javax.swing.JTextField();
|
||||
chkDontCheckGame = new javax.swing.JCheckBox();
|
||||
pnlModManagement = new AnimatedPanel();
|
||||
pnlModManagementContent = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
@@ -451,7 +452,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addComponent(lblDimensionX)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 402, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
|
||||
.addComponent(chkFullscreen))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlSettingsLayout.createSequentialGroup()
|
||||
.addComponent(txtMaxMemory)
|
||||
@@ -508,7 +509,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addComponent(lblDimensionX, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDimension)
|
||||
.addComponent(txtWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 228, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 99, Short.MAX_VALUE)
|
||||
.addGroup(pnlSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnDownloadAllAssets)
|
||||
.addComponent(btnCleanGame))
|
||||
@@ -573,39 +574,46 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
}
|
||||
});
|
||||
|
||||
chkDontCheckGame.setText(C.i18n("advancedsettings.dont_check_game_completeness")); // NOI18N
|
||||
chkDontCheckGame.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
chkDontCheckGameItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout pnlAdvancedSettingsLayout = new javax.swing.GroupLayout(pnlAdvancedSettings);
|
||||
pnlAdvancedSettings.setLayout(pnlAdvancedSettingsLayout);
|
||||
pnlAdvancedSettingsLayout.setHorizontalGroup(
|
||||
pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtWrapperLauncher)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addComponent(lblPrecalledCommand1)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
.addComponent(txtPrecalledCommand)
|
||||
.addComponent(txtServerIP)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPrecalledCommand)
|
||||
.addComponent(lblServerIP))
|
||||
.addGap(0, 716, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblMinecraftArgs)
|
||||
.addComponent(lblPermSize)
|
||||
.addComponent(lblJavaArgs))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtJavaArgs)
|
||||
.addComponent(txtMinecraftArgs)
|
||||
.addComponent(txtPermSize, javax.swing.GroupLayout.Alignment.TRAILING))))
|
||||
.addComponent(txtPrecalledCommand)
|
||||
.addComponent(txtServerIP)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblMinecraftArgs)
|
||||
.addComponent(lblPermSize)
|
||||
.addComponent(lblJavaArgs))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtJavaArgs, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
|
||||
.addComponent(txtMinecraftArgs)
|
||||
.addComponent(txtPermSize, javax.swing.GroupLayout.Alignment.TRAILING)))
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtWrapperLauncher)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addComponent(lblPrecalledCommand1)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(chkDontCheckGame))
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPrecalledCommand)
|
||||
.addComponent(lblServerIP))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
pnlAdvancedSettingsLayout.setVerticalGroup(
|
||||
pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -634,8 +642,10 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addComponent(lblServerIP)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtServerIP, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 168, Short.MAX_VALUE)
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addComponent(chkDontCheckGame))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@@ -679,13 +689,13 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
pnlModManagementContentLayout.setHorizontalGroup(
|
||||
pnlModManagementContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlModManagementContentLayout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 889, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlModManagementContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(btnRemoveMod, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnAddMod, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlModManagementContentLayout.createSequentialGroup()
|
||||
.addComponent(lblModInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 985, Short.MAX_VALUE)
|
||||
.addComponent(lblModInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 646, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
pnlModManagementContentLayout.setVerticalGroup(
|
||||
@@ -697,7 +707,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnRemoveMod)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblModInfo))
|
||||
);
|
||||
@@ -914,7 +924,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addContainerGap(916, Short.MAX_VALUE)))
|
||||
.addContainerGap(577, Short.MAX_VALUE)))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -930,7 +940,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(576, Short.MAX_VALUE)
|
||||
.addContainerGap(447, Short.MAX_VALUE)
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addContainerGap()))
|
||||
);
|
||||
@@ -1160,6 +1170,11 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setWrapper(txtWrapperLauncher.getText());
|
||||
}//GEN-LAST:event_txtWrapperLauncherFocusLost
|
||||
|
||||
private void chkDontCheckGameItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkDontCheckGameItemStateChanged
|
||||
if (!isLoading)
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setNotCheckGame(chkDontCheckGame.isSelected());
|
||||
}//GEN-LAST:event_chkDontCheckGameItemStateChanged
|
||||
|
||||
// </editor-fold>
|
||||
// <editor-fold defaultstate="collapsed" desc="Load">
|
||||
void prepareVersionSetting(VersionSetting profile) {
|
||||
@@ -1175,6 +1190,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
txtPrecalledCommand.setText(profile.getPrecalledCommand());
|
||||
txtServerIP.setText(profile.getServerIp());
|
||||
chkNoJVMArgs.setSelected(profile.isNoJVMArgs());
|
||||
chkDontCheckGame.setSelected(profile.isNotCheckGame());
|
||||
chkFullscreen.setSelected(profile.isFullscreen());
|
||||
cboLauncherVisibility.setSelectedIndex(profile.getLauncherVisibility().ordinal());
|
||||
cboRunDirectory.setSelectedIndex(profile.getGameDirType().ordinal());
|
||||
@@ -1325,6 +1341,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
private javax.swing.JComboBox cboProfiles;
|
||||
private javax.swing.JComboBox cboRunDirectory;
|
||||
private javax.swing.JComboBox cboVersions;
|
||||
private javax.swing.JCheckBox chkDontCheckGame;
|
||||
private javax.swing.JCheckBox chkFullscreen;
|
||||
private javax.swing.JCheckBox chkNoJVMArgs;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
|
||||
@@ -52,10 +52,10 @@ import org.jackhuang.hellominecraft.util.ui.GraphicsUtils;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.Theme;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.Utils;
|
||||
import org.jackhuang.hellominecraft.util.ui.DropShadowBorder;
|
||||
import org.jackhuang.hellominecraft.util.ui.TintablePanel;
|
||||
import org.jackhuang.hellominecraft.util.ui.BasicColors;
|
||||
import org.jackhuang.hellominecraft.util.ui.SwingUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -168,7 +168,7 @@ public final class MainFrame extends DraggableFrame {
|
||||
|
||||
ImageIcon headerIcon = Main.getIcon("icon.png");
|
||||
this.setIconImage(headerIcon.getImage());
|
||||
headerIcon = Utils.scaleImage(headerIcon, 16, 16);
|
||||
headerIcon = SwingUtils.scaleImage(headerIcon, 16, 16);
|
||||
JLabel headerLabel = new JLabel(headerIcon);
|
||||
headerLabel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
|
||||
header.add(headerLabel);
|
||||
@@ -318,7 +318,7 @@ public final class MainFrame extends DraggableFrame {
|
||||
ImageIcon background;
|
||||
|
||||
public void loadBackground() {
|
||||
background = Utils.searchBackgroundImage(Main.getIcon(Settings.getInstance().getTheme().settings.get("Customized.MainFrame.background_image")), Settings.getInstance().getBgpath(), 800, 480);
|
||||
background = SwingUtils.searchBackgroundImage(Main.getIcon(Settings.getInstance().getTheme().settings.get("Customized.MainFrame.background_image")), Settings.getInstance().getBgpath(), 800, 480);
|
||||
if (background != null)
|
||||
if (backgroundLabel == null) {
|
||||
backgroundLabel = new JLabel(background);
|
||||
|
||||
@@ -354,7 +354,7 @@ public class MainPagePanel extends AnimatedPanel {
|
||||
if (l.isLoggedIn())
|
||||
l.logOut();
|
||||
cl.first(pnlPassword);
|
||||
pnlPassword.repaint();
|
||||
SwingUtilities.invokeLater(this::repaint);
|
||||
}//GEN-LAST:event_btnLogoutActionPerformed
|
||||
|
||||
private void txtPlayerNameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPlayerNameKeyPressed
|
||||
|
||||
@@ -19,19 +19,13 @@ package org.jackhuang.hellominecraft.util;
|
||||
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import com.sun.management.OperatingSystemMXBean;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Random;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
* @author huangyuhui
|
||||
@@ -52,18 +46,6 @@ public final class Utils {
|
||||
return ((URLClassLoader) Utils.class.getClassLoader()).getURLs();
|
||||
}
|
||||
|
||||
public static String[] getURLString() {
|
||||
URL[] urls = ((URLClassLoader) Utils.class.getClassLoader()).getURLs();
|
||||
String[] urlStrings = new String[urls.length];
|
||||
for (int i = 0; i < urlStrings.length; i++)
|
||||
try {
|
||||
urlStrings[i] = URLDecoder.decode(urls[i].getPath(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
HMCLog.warn("Unsupported UTF-8 encoding", ex);
|
||||
}
|
||||
return urlStrings;
|
||||
}
|
||||
|
||||
public static int getSuggestedMemorySize() {
|
||||
try {
|
||||
OperatingSystemMXBean osmb = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
|
||||
@@ -80,65 +62,6 @@ public final class Utils {
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
|
||||
}
|
||||
|
||||
public static ImageIcon scaleImage(ImageIcon i, int x, int y) {
|
||||
return new ImageIcon(i.getImage().getScaledInstance(x, y, Image.SCALE_SMOOTH));
|
||||
}
|
||||
|
||||
public static ImageIcon searchBackgroundImage(ImageIcon init, String bgpath, int width, int height) {
|
||||
Random r = new Random();
|
||||
boolean loaded = false;
|
||||
ImageIcon background = init;
|
||||
|
||||
// bgpath
|
||||
if (StrUtils.isNotBlank(bgpath) && !loaded) {
|
||||
String[] backgroundPath = bgpath.split(";");
|
||||
if (backgroundPath.length > 0) {
|
||||
int index = r.nextInt(backgroundPath.length);
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage(backgroundPath[index]).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in bgpath.");
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
// bgskin
|
||||
if (!loaded) {
|
||||
File backgroundImageFile = new File("bg");
|
||||
if (backgroundImageFile.exists() && backgroundImageFile.isDirectory()) {
|
||||
String[] backgroundPath = backgroundImageFile.list();
|
||||
if (backgroundPath.length > 0) {
|
||||
int index = r.nextInt(backgroundPath.length);
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage("bg" + File.separator + backgroundPath[index]).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in bgskin folder.");
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// background.png
|
||||
if (!loaded) {
|
||||
File backgroundImageFile = new File("background.png");
|
||||
if (backgroundImageFile.exists()) {
|
||||
loaded = true;
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage(backgroundImageFile.getAbsolutePath()).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in background.png.");
|
||||
}
|
||||
}
|
||||
|
||||
// background.jpg
|
||||
if (!loaded) {
|
||||
File backgroundImageFile = new File("background.jpg");
|
||||
if (backgroundImageFile.exists()) {
|
||||
//loaded = true;
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage(backgroundImageFile.getAbsolutePath()).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in background.jpg.");
|
||||
}
|
||||
}
|
||||
|
||||
if (background == null)
|
||||
return init;
|
||||
return background;
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to fight against the permission manager by Minecraft Forge.
|
||||
*
|
||||
|
||||
@@ -54,6 +54,15 @@ public class IOUtils {
|
||||
return path + File.separatorChar;
|
||||
}
|
||||
|
||||
public static String addURLSeparator(String path) {
|
||||
if (path == null || path.trim().length() == 0)
|
||||
return "";
|
||||
if (path.charAt(path.length() - 1) == '/')
|
||||
return path;
|
||||
else
|
||||
return path + '/';
|
||||
}
|
||||
|
||||
public static boolean isSeparator(char ch) {
|
||||
return ch == File.separatorChar || ch == '/' || ch == '\\';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 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.tasks;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class DeleteFileTask extends Task {
|
||||
|
||||
File f;
|
||||
|
||||
public DeleteFileTask(File f) {
|
||||
this.f = f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeTask() throws Throwable {
|
||||
f.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfo() {
|
||||
return "Delete: " + f.getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,8 +17,6 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.util.ui;
|
||||
|
||||
import java.awt.Frame;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.SimpleAttributeSet;
|
||||
import javax.swing.text.StyleConstants;
|
||||
@@ -28,7 +26,6 @@ import org.jackhuang.hellominecraft.util.logging.Level;
|
||||
import org.jackhuang.hellominecraft.util.func.NonFunction;
|
||||
import org.jackhuang.hellominecraft.util.DoubleOutputStream;
|
||||
import org.jackhuang.hellominecraft.util.LauncherPrintStream;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.Utils;
|
||||
|
||||
/**
|
||||
@@ -254,7 +251,7 @@ public class LogWindow extends javax.swing.JFrame {
|
||||
StyleConstants.setForeground(sas, c.COLOR);
|
||||
try {
|
||||
d.insertString(d.getLength(), status, sas);
|
||||
} catch (BadLocationException ex) {
|
||||
} catch (Exception ex) {
|
||||
HMCLog.err("Failed to insert \"" + status + "\" to " + d.getLength(), ex);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ package org.jackhuang.hellominecraft.util.ui;
|
||||
import java.awt.Component;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -28,7 +29,9 @@ import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
@@ -302,4 +305,63 @@ public class SwingUtils {
|
||||
else
|
||||
thisFrame.dispose();
|
||||
}
|
||||
|
||||
public static ImageIcon scaleImage(ImageIcon i, int x, int y) {
|
||||
return new ImageIcon(i.getImage().getScaledInstance(x, y, Image.SCALE_SMOOTH));
|
||||
}
|
||||
|
||||
public static ImageIcon searchBackgroundImage(ImageIcon init, String bgpath, int width, int height) {
|
||||
Random r = new Random();
|
||||
boolean loaded = false;
|
||||
ImageIcon background = init;
|
||||
|
||||
// bgpath
|
||||
if (StrUtils.isNotBlank(bgpath) && !loaded) {
|
||||
String[] backgroundPath = bgpath.split(";");
|
||||
if (backgroundPath.length > 0) {
|
||||
int index = r.nextInt(backgroundPath.length);
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage(backgroundPath[index]).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in bgpath.");
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
// bgskin
|
||||
if (!loaded) {
|
||||
File backgroundImageFile = new File("bg");
|
||||
if (backgroundImageFile.exists() && backgroundImageFile.isDirectory()) {
|
||||
String[] backgroundPath = backgroundImageFile.list();
|
||||
if (backgroundPath.length > 0) {
|
||||
int index = r.nextInt(backgroundPath.length);
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage("bg" + File.separator + backgroundPath[index]).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in bgskin folder.");
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// background.png
|
||||
if (!loaded) {
|
||||
File backgroundImageFile = new File("background.png");
|
||||
if (backgroundImageFile.exists()) {
|
||||
loaded = true;
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage(backgroundImageFile.getAbsolutePath()).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in background.png.");
|
||||
}
|
||||
}
|
||||
|
||||
// background.jpg
|
||||
if (!loaded) {
|
||||
File backgroundImageFile = new File("background.jpg");
|
||||
if (backgroundImageFile.exists()) {
|
||||
//loaded = true;
|
||||
background = new ImageIcon(Toolkit.getDefaultToolkit().getImage(backgroundImageFile.getAbsolutePath()).getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||
HMCLog.log("Prepared background image in background.jpg.");
|
||||
}
|
||||
}
|
||||
|
||||
if (background == null)
|
||||
return init;
|
||||
return background;
|
||||
}
|
||||
}
|
||||
@@ -289,6 +289,7 @@ advancedsettings.wrapper_launcher=前置指令(不必填写,如optirun)
|
||||
advancedsettings.precall_command=启动前执行命令(不必填写,将在游戏启动前调用)
|
||||
advancedsettings.server_ip=直入服务器ip地址(不必填写,启动游戏后直接进入对应服务器)
|
||||
advancedsettings.cancel_wrapper_launcher=取消包裹启动器(出现奇怪问题时可尝试使用,与调试模式冲突)
|
||||
advancedsettings.dont_check_game_completeness=不检查游戏完整性
|
||||
|
||||
mainwindow.show_log=查看日志
|
||||
mainwindow.make_launch_script=生成启动脚本
|
||||
|
||||
@@ -289,6 +289,7 @@ advancedsettings.wrapper_launcher=\u524d\u7f6e\u6307\u4ee4(\u4e0d\u5fc5\u586b\u5
|
||||
advancedsettings.precall_command=\u542f\u52a8\u524d\u6267\u884c\u547d\u4ee4(\u4e0d\u5fc5\u586b\u5199\uff0c\u5c06\u5728\u6e38\u620f\u542f\u52a8\u524d\u8c03\u7528)
|
||||
advancedsettings.server_ip=\u76f4\u5165\u670d\u52a1\u5668ip\u5730\u5740(\u4e0d\u5fc5\u586b\u5199\uff0c\u542f\u52a8\u6e38\u620f\u540e\u76f4\u63a5\u8fdb\u5165\u5bf9\u5e94\u670d\u52a1\u5668)
|
||||
advancedsettings.cancel_wrapper_launcher=\u53d6\u6d88\u5305\u88f9\u542f\u52a8\u5668\uff08\u51fa\u73b0\u5947\u602a\u95ee\u9898\u65f6\u53ef\u5c1d\u8bd5\u4f7f\u7528,\u4e0e\u8c03\u8bd5\u6a21\u5f0f\u51b2\u7a81\uff09
|
||||
advancedsettings.dont_check_game_completeness=\u4e0d\u68c0\u67e5\u6e38\u620f\u5b8c\u6574\u6027
|
||||
|
||||
mainwindow.show_log=\u67e5\u770b\u65e5\u5fd7
|
||||
mainwindow.make_launch_script=\u751f\u6210\u542f\u52a8\u811a\u672c
|
||||
|
||||
@@ -289,6 +289,7 @@ advancedsettings.wrapper_launcher=Wrapper Launcher(like optirun...)
|
||||
advancedsettings.precall_command=Precalling command(will be executed before game launching)
|
||||
advancedsettings.server_ip=Server Host
|
||||
advancedsettings.cancel_wrapper_launcher=Cancel Wrapper Launcher
|
||||
advancedsettings.dont_check_game_completeness=Dont check game completeness
|
||||
|
||||
mainwindow.show_log=Show Logs
|
||||
mainwindow.make_launch_script=Make Launching Script.
|
||||
|
||||
@@ -289,6 +289,7 @@ advancedsettings.wrapper_launcher=Wrapper Launcher(like optirun...)
|
||||
advancedsettings.precall_command=Precalling command(will be executed before game launching)
|
||||
advancedsettings.server_ip=Server Host
|
||||
advancedsettings.cancel_wrapper_launcher=Cancel Wrapper Launcher
|
||||
advancedsettings.dont_check_game_completeness=Dont check game completeness
|
||||
|
||||
mainwindow.show_log=Show Logs
|
||||
mainwindow.make_launch_script=Make Launching Script.
|
||||
|
||||
@@ -289,6 +289,7 @@ advancedsettings.wrapper_launcher=前置指令(不必填寫,如optirun)
|
||||
advancedsettings.precall_command=啟動前執行命令(不必填寫,將在遊戲啟動前調用)
|
||||
advancedsettings.server_ip=直入伺服器ip地址(不必填寫,啟動遊戲後直接進入對應伺服器)
|
||||
advancedsettings.cancel_wrapper_launcher=取消包裹啟動器(出現奇怪問題時可嘗試使用,與調試模式衝突)
|
||||
advancedsettings.dont_check_game_completeness=不檢查遊戲完整性
|
||||
|
||||
mainwindow.show_log=查看日誌
|
||||
mainwindow.make_launch_script=生成啟動腳本
|
||||
|
||||
@@ -289,6 +289,7 @@ advancedsettings.wrapper_launcher=\u524d\u7f6e\u6307\u4ee4(\u4e0d\u5fc5\u586b\u5
|
||||
advancedsettings.precall_command=\u555f\u52d5\u524d\u57f7\u884c\u547d\u4ee4(\u4e0d\u5fc5\u586b\u5beb,\u5c07\u5728\u904a\u6232\u555f\u52d5\u524d\u8abf\u7528)
|
||||
advancedsettings.server_ip=\u76f4\u5165\u4f3a\u670d\u5668ip\u5730\u5740(\u4e0d\u5fc5\u586b\u5beb\uff0c\u555f\u52d5\u904a\u6232\u5f8c\u76f4\u63a5\u9032\u5165\u5c0d\u61c9\u4f3a\u670d\u5668)
|
||||
advancedsettings.cancel_wrapper_launcher=\u53d6\u6d88\u5305\u88f9\u555f\u52d5\u5668(\u51fa\u73fe\u5947\u602a\u554f\u984c\u6642\u53ef\u5617\u8a66\u4f7f\u7528,\u8207\u8abf\u8a66\u6a21\u5f0f\u885d\u7a81)
|
||||
advancedsettings.dont_check_game_completeness=\u4e0d\u6aa2\u67e5\u904a\u6232\u5b8c\u6574\u6027
|
||||
|
||||
mainwindow.show_log=\u67e5\u770b\u65e5\u8a8c
|
||||
mainwindow.make_launch_script=\u751f\u6210\u555f\u52d5\u8173\u672c
|
||||
|
||||
@@ -20,12 +20,9 @@ import java.util.jar.Pack200
|
||||
import java.util.zip.GZIPOutputStream
|
||||
import java.security.MessageDigest
|
||||
|
||||
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
//sourceCompatibility = '1.7'
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
repositories {
|
||||
@@ -39,8 +36,6 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Adding dependencies here will add the dependencies to each subproject.
|
||||
|
||||
compile 'com.google.code.gson:gson:2.2.4' // Apache License 2.0
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user