reconstruct code && add advice for out of memory error.

This commit is contained in:
huanghongxun
2015-07-06 12:50:02 +08:00
parent d398de5d4e
commit 244b646225
183 changed files with 381 additions and 346 deletions

View File

@@ -22,7 +22,7 @@ import java.util.ResourceBundle;
/**
*
* @author hyh
* @author huangyuhui
*/
public final class C {
public static final Gson gsonPrettyPrinting = new GsonBuilder().setPrettyPrinting().create();

View File

@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.logger.Logger;
/**
*
* @author hyh
* @author huangyuhui
*/
public class HMCLog {

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.logging.layout.DefaultLayout;
/**
*
* @author hyh
* @author huangyuhui
*/
public class Configuration {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging;
/**
*
* @author hyh
* @author huangyuhui
*/
public enum Level {

View File

@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.logging.message.IMessage;
/**
*
* @author hyh
* @author huangyuhui
*/
public class LogEvent {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging;
/**
*
* @author hyh
* @author huangyuhui
*/
public class LoggingException extends RuntimeException {

View File

@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract class AbstractAppender implements IAppender {

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
/**
*
* @author hyh
* @author huangyuhui
*/
public class ConsoleAppender extends OutputStreamAppender {

View File

@@ -22,7 +22,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface IAppender {

View File

@@ -28,7 +28,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract class OutputStreamAppender extends AbstractAppender {

View File

@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.logging.LogEvent;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract class AbstractStringLayout implements ILayout<String> {

View File

@@ -22,7 +22,7 @@ import org.jackhuang.hellominecraft.logging.LogEvent;
/**
*
* @author hyh
* @author huangyuhui
*/
public class DefaultLayout extends AbstractStringLayout {
private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");

View File

@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.LogEvent;
/**
*
* @author hyh
* @author huangyuhui
* @param <T>
*/
public interface ILayout<T extends Serializable> {

View File

@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.message.IMessage;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface ILogger {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract class AbstractMessageFactory
implements IMessageFactory {

View File

@@ -20,7 +20,7 @@ import java.io.Serializable;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface IMessage extends Serializable {
String getFormattedMessage();

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract interface IMessageFactory {

View File

@@ -27,7 +27,7 @@ import java.util.Set;
/**
*
* @author hyh
* @author huangyuhui
*/
public class ParameterizedMessage
implements IMessage {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
/**
*
* @author hyh
* @author huangyuhui
*/
public final class ParameterizedMessageFactory extends AbstractMessageFactory {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
/**
*
* @author hyh
* @author huangyuhui
*/
public class SimpleMessage
implements IMessage {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface DoingDoneListener<K> {
/**

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract class ProgressProvider {
protected ProgressProviderListener ppl;

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface ProgressProviderListener {
void setProgress(int prog, int max);

View File

@@ -20,7 +20,7 @@ import java.util.Collection;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract class Task extends ProgressProvider {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
/**
*
* @author hyh
* @author huangyuhui
*/
public abstract class TaskInfo extends Task {

View File

@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.HMCLog;
/**
*
* @author hyh
* @author huangyuhui
*/
public class TaskList extends Thread {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
/**
*
* @author hyh
* @author huangyuhui
*/
public class TaskRunnable extends TaskInfo {
private final Runnable r;

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.utils.functions.Consumer;
/**
*
* @author hyh
* @author huangyuhui
* @param <T> Runnable&lt;T&gt;
*/
public class TaskRunnableArg1<T> extends TaskInfo implements PreviousResultRegistrator<T> {

View File

@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.utils.SwingUtils;
/**
*
* @author hyh
* @author huangyuhui
*/
public class TaskWindow extends javax.swing.JDialog
implements ProgressProviderListener, NonConsumer, DoingDoneListener<Task> {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks.communication;
/**
*
* @author hyh
* @author huangyuhui
* @param <T> Task result type
*/
public interface PreviousResult<T> {

View File

@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.tasks.Task;
/**
*
* @author hyh
* @author huangyuhui
* @param <T> Previous task result type
*/
public interface PreviousResultRegistrator<T> {

View File

@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.views.LogWindow;
/**
*
* @author hyh
* @author huangyuhui
*/
public class ContentGetAndShowTask extends HTTPGetTask implements Event<String> {

View File

@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.tasks.ProgressProviderListener;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface DownloadListener extends ProgressProviderListener {

View File

@@ -38,7 +38,7 @@ import org.jackhuang.hellominecraft.utils.system.IOUtils;
/**
*
* @author hyh
* @author huangyuhui
*/
// This class downloads a file from a URL.
public class FileDownloadTask extends Task implements PreviousResult<File>, PreviousResultRegistrator<String> {

View File

@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.utils.EventHandler;
/**
*
* @author hyh
* @author huangyuhui
*/
public class HTTPGetTask extends TaskInfo implements PreviousResult<String> {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks.download;
/**
*
* @author hyh
* @author huangyuhui
*/
public class NetException extends RuntimeException {

View File

@@ -22,7 +22,7 @@ import java.util.Map;
/**
*
* @author hyh
* @author huangyuhui
*/
public class ArrayUtils {

View File

@@ -24,7 +24,7 @@ import java.util.Iterator;
/**
*
* @author hyh
* @author huangyuhui
*/
public final class CollectionUtils {
public static <T> void forEach(Collection<T> coll, Consumer<T> p) {

View File

@@ -21,7 +21,7 @@ import java.io.OutputStream;
/**
*
* @author hyh
* @author huangyuhui
*/
public class DoubleOutputStream extends OutputStream {

View File

@@ -23,7 +23,7 @@ import java.util.ArrayList;
/**
*
* @author hyh
* @author huangyuhui
*/
public class LauncherPrintStream extends PrintStream {

View File

@@ -20,7 +20,7 @@ import java.util.Map;
/**
*
* @author hyh
* @author huangyuhui
* @param <K> K Type
* @param <V> V Type
*/

View File

@@ -22,7 +22,7 @@ import java.util.Set;
/**
*
* @author hyh
* @author huangyuhui
*/
public class ReflectUtils {

View File

@@ -22,7 +22,7 @@ import javax.swing.text.JTextComponent;
/**
*
* @author hyh
* @author huangyuhui
*/
public class TextComponentOutputStream extends OutputStream {

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.HMCLog;
/**
*
* @author hyh
* @author huangyuhui
*/
public final class UpdateChecker extends Thread {
public static boolean OUT_DATED = false;

View File

@@ -41,7 +41,7 @@ import org.jackhuang.hellominecraft.C;
import org.jackhuang.hellominecraft.HMCLog;
/**
* @author hyh
* @author huangyuhui
*/
public final class Utils {

View File

@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.HMCLog;
/**
*
* @author hyh
* @author huangyuhui
*/
public final class VersionNumber implements Comparable<VersionNumber> {

View File

@@ -20,7 +20,7 @@ import java.io.UnsupportedEncodingException;
/**
*
* @author hyh
* @author huangyuhui
*/
public class Base64 {

View File

@@ -24,7 +24,7 @@ import java.security.NoSuchAlgorithmException;
/**
*
* @author hyh
* @author huangyuhui
*/
public class DigestUtils {

View File

@@ -17,7 +17,7 @@
package org.jackhuang.hellominecraft.utils.functions;
/**
* @author hyh
* @author huangyuhui
*/
public interface BiConsumer<V, V2> {
void onDone(V value, V2 value2);

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
/**
*
* @author hyh
* @author huangyuhui
*/
public class FalseFunction implements NonFunction<Boolean> {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface NonConsumer {
void onDone();

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface NonFunction<T> {
T onDone();

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface Predicate<T> {
boolean apply(T t);

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
/**
*
* @author hyh
* @author huangyuhui
*/
public interface TriConsumer<V1, V2, V3> {
void onDone(V1 v1, V2 v2, V3 v3);

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
/**
*
* @author hyh
* @author huangyuhui
*/
public class TrueFunction implements NonFunction<Boolean> {

View File

@@ -31,7 +31,7 @@ import org.jackhuang.hellominecraft.utils.StrUtils;
/**
* 文件压缩/解压类
*
* @author hyh
* @author huangyuhui
*/
public class Compressor {

View File

@@ -31,7 +31,7 @@ import org.jackhuang.hellominecraft.utils.NetUtils;
/**
*
* @author hyh
* @author huangyuhui
*/
public class FileUtils {

View File

@@ -23,7 +23,7 @@ import java.util.List;
/**
*
* @author hyh
* @author huangyuhui
*/
public class JavaProcess {

View File

@@ -16,7 +16,6 @@
*/
package org.jackhuang.hellominecraft.utils.system;
import org.jackhuang.hellominecraft.utils.system.Platform;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -29,7 +28,7 @@ import org.jackhuang.hellominecraft.utils.StrUtils;
/**
*
* @author hyh
* @author huangyuhui
*/
public final class JdkVersion {

View File

@@ -20,7 +20,7 @@ import javax.swing.JOptionPane;
import org.jackhuang.hellominecraft.C;
/**
* @author hyh
* @author huangyuhui
*/
public class MessageBox
{

View File

@@ -21,7 +21,7 @@ import java.lang.management.ManagementFactory;
import org.jackhuang.hellominecraft.HMCLog;
/**
* @author hyh
* @author huangyuhui
*/
public enum OS {

View File

@@ -25,7 +25,7 @@ import org.jackhuang.hellominecraft.utils.EventHandler;
/**
*
* @author hyh
* @author huangyuhui
*/
public class ProcessThread extends Thread {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.version;
/**
*
* @author hyh
* @author huangyuhui
*/
public class MinecraftRemoteLatestVersion {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.version;
/**
*
* @author hyh
* @author huangyuhui
*/
public class MinecraftRemoteVersion {

View File

@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.C;
/**
*
* @author hyh
* @author huangyuhui
*/
public class MinecraftRemoteVersions {

View File

@@ -19,7 +19,7 @@ package org.jackhuang.hellominecraft.version;
import org.jackhuang.hellominecraft.C;
/**
* @author hyh
* @author huangyuhui
*/
public class MinecraftVersionRequest {
public static final int Unkown = 0, Invaild = 1, InvaildJar = 2,

View File

@@ -20,7 +20,7 @@ import java.awt.Color;
/**
*
* @author hyh
* @author huangyuhui
*/
public class BasicColors {

View File

@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.utils.Utils;
/**
*
* @author hyh
* @author huangyuhui
*/
public class LogWindow extends javax.swing.JFrame {

View File

@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.views;
/**
* The frame given to choose things.
* @author hyh
* @author huangyuhui
*/
public class Selector extends javax.swing.JDialog {
String[] selList;

View File

@@ -105,6 +105,7 @@ crash.advice.ClassNotFoundException=Minecraft\u4e0d\u5b8c\u6574\u6216Mod\u51b2\u
crash.advice.NoSuchFieldError=Minecraft\u4e0d\u5b8c\u6574\u6216Mod\u51b2\u7a81\uff0c\u5982\u679c\u6709\u672a\u80fd\u4e0b\u8f7d\u7684\u6587\u4ef6\u8bf7\u4e0b\u8f7d\u6210\u529f\u540e\u91cd\u8bd5\u6216\u4e0b\u8f7d\u6574\u5408\u5305\u89e3\u51b3\u95ee\u9898\u3002
crash.advice.LWJGLException=\u60a8\u7684\u7535\u8111\u4e0d\u6b63\u5e38\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u9a71\u52a8\u7cbe\u7075\u6216\u5176\u4ed6\u5b89\u88c5\u5668\u66f4\u65b0\u663e\u5361\u9a71\u52a8\u3002
crash.advice.SecurityException=\u53ef\u80fd\u662f\u60a8\u4fee\u6539\u4e86minecraft.jar\u4f46\u672a\u5220\u9664META-INF\u6587\u4ef6\u5939\u7684\u539f\u56e0\u3002\u8bf7\u901a\u8fc7\u538b\u7f29\u8f6f\u4ef6\u5220\u9664jar\u4e2d\u7684META-INF\u6587\u4ef6\u5939\u3002
crash.advice.OutOfMemoryError=\u5185\u5b58\u6ea2\u51fa\uff0c\u60a8\u8bbe\u7f6e\u7684Minecraft\u6700\u5927\u5185\u5b58\u8fc7\u5c0f\uff0c\u8bf7\u8c03\u5927\uff01
crash.advice.otherwise=\u53ef\u80fd\u662fMod\u6216\u5176\u4ed6\u95ee\u9898\u3002
crash.advice.OpenGL=\u53ef\u80fd\u662f\u663e\u5361/\u58f0\u5361\u9a71\u52a8\u95ee\u9898\uff0c\u4e5f\u53ef\u80fd\u662fMod\u5bfc\u81f4\u7684\u95ee\u9898\u3002

View File

@@ -100,6 +100,7 @@ crash.advice.ClassNotFoundException=Minecraft or mods are incomplete. Retry if t
crash.advice.NoSuchFieldError=Minecraft or mods are incomplete. Retry if there are some libraries that have not downloaded or update your game and mods!
crash.advice.LWJGLException=Maybe your video driver does not work well, please update your video driver.
crash.advice.SecurityException=Maybe you have modified minecraft.jar but have not removed the META-INF.
crash.advice.OutOfMemoryError=The maximum memory of JVM is too small, please modify it.
crash.advice.otherwise=Maybe mods caused problems.
crash.advice.OpenGL=Maybe drivers caused problems.

View File

@@ -100,6 +100,7 @@ crash.advice.ClassNotFoundException=Minecraft\u4e0d\u5b8c\u6574\u6216Mod\u51b2\u
crash.advice.NoSuchFieldError=Minecraft\u4e0d\u5b8c\u6574\u6216Mod\u51b2\u7a81\uff0c\u5982\u679c\u6709\u672a\u80fd\u4e0b\u8f7d\u7684\u6587\u4ef6\u8bf7\u4e0b\u8f7d\u6210\u529f\u540e\u91cd\u8bd5\u6216\u4e0b\u8f7d\u6574\u5408\u5305\u89e3\u51b3\u95ee\u9898\u3002
crash.advice.LWJGLException=\u60a8\u7684\u7535\u8111\u4e0d\u6b63\u5e38\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u9a71\u52a8\u7cbe\u7075\u6216\u5176\u4ed6\u5b89\u88c5\u5668\u66f4\u65b0\u663e\u5361\u9a71\u52a8\u3002
crash.advice.SecurityException=\u53ef\u80fd\u662f\u60a8\u4fee\u6539\u4e86minecraft.jar\u4f46\u672a\u5220\u9664META-INF\u6587\u4ef6\u5939\u7684\u539f\u56e0\u3002\u8bf7\u901a\u8fc7\u538b\u7f29\u8f6f\u4ef6\u5220\u9664jar\u4e2d\u7684META-INF\u6587\u4ef6\u5939\u3002
crash.advice.OutOfMemoryError=\u5185\u5b58\u6ea2\u51fa\uff0c\u60a8\u8bbe\u7f6e\u7684Minecraft\u6700\u5927\u5185\u5b58\u8fc7\u5c0f\uff0c\u8bf7\u8c03\u5927\uff01
crash.advice.otherwise=\u53ef\u80fd\u662fMod\u6216\u5176\u4ed6\u95ee\u9898\u3002
crash.advice.OpenGL=\u53ef\u80fd\u662f\u663e\u5361/\u58f0\u5361\u9a71\u52a8\u95ee\u9898\uff0c\u4e5f\u53ef\u80fd\u662fMod\u5bfc\u81f4\u7684\u95ee\u9898\u3002

View File

@@ -100,6 +100,7 @@ crash.advice.ClassNotFoundException=Minecraft\u4e0d\u5b8c\u6574\u6216Mod\u885d\u
crash.advice.NoSuchFieldError=Minecraft\u4e0d\u5b8c\u6574\u6216Mod\u885d\u7a81\uff0c\u5982\u679c\u6709\u672a\u80fd\u4e0b\u8f7d\u7684\u6587\u4ef6\u8bf7\u4e0b\u8f7d\u6210\u529f\u540e\u91cd\u8bd5\u6216\u4e0b\u8f09\u6574\u5408\u5305\u89e3\u6c7a\u554f\u984c\u3002
crash.advice.LWJGLException=\u60a8\u7684\u7535\u8111\u4e0d\u6b63\u5e38\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u9a71\u52a8\u7cbe\u7075\u6216\u5176\u4ed6\u5b89\u88c5\u5668\u66f4\u65b0\u663e\u5361\u9a71\u52a8\u3002
crash.advice.SecurityException=\u53ef\u80fd\u662f\u60a8\u4fee\u6539\u4e86minecraft.jar\u4f46\u672a\u522a\u9664META-INF\u6587\u4ef6\u593e\u7684\u539f\u56e0\u3002\u8acb\u901a\u904e\u58d3\u7e2e\u8edf\u4ef6\u522a\u9664jar\u4e2d\u7684META-INF\u6587\u4ef6\u593e\u3002
crash.advice.OutOfMemoryError=\u5185\u5b58\u6ea2\u51fa\uff0c\u60a8\u8bbe\u7f6e\u7684Minecraft\u6700\u5927\u5185\u5b58\u8fc7\u5c0f\uff0c\u8bf7\u8c03\u5927\uff01
crash.advice.otherwise=\u53ef\u80fd\u662fMod\u6216\u5176\u4ed6\u554f\u984c\u3002
crash.advice.OpenGL=\u53ef\u80fd\u662f\u986f\u5361/\u8072\u5361\u9a45\u52d5\u554f\u984c\uff0c\u4e5f\u53ef\u80fd\u662fMod\u5c0e\u81f4\u7684\u554f\u984c\u3002