Guard against instances where the GLWindow is closed without being opened (#Forge)

This commit is contained in:
Sollace 2018-11-01 18:14:24 +02:00
parent 9f3042356b
commit 0bf874c1f9

View file

@ -1,10 +1,14 @@
package com.voxelmodpack.hdskins.upload; package com.voxelmodpack.hdskins.upload;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mumfrey.liteloader.util.ModUtilities;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.DefaultResourcePack; import net.minecraft.client.resources.DefaultResourcePack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.DisplayMode;
@ -38,6 +42,8 @@ public class GLWindow extends DropTarget {
@Nullable @Nullable
private static GLWindow instance = null; private static GLWindow instance = null;
private static final Logger logger = LogManager.getLogger();
/** /**
* Gets or creates the current GLWindow context. * Gets or creates the current GLWindow context.
*/ */
@ -162,6 +168,27 @@ public class GLWindow extends DropTarget {
} }
private synchronized void close() { private synchronized void close() {
if (frame == null) {
String msg = "GLClose was called in an illegal state! You cannot close the GLWindow before it has been opened.";
if (ModUtilities.fmlIsPresent()) {
logger.fatal("========================================================");
logger.fatal("!!!!!! MINECRAFT FORGE / FORGE MODLOADER DETECTED !!!!!!");
logger.fatal("FML was detected! Forge is known to cause severe incompatibilities and instability with other mods"
+ " above and beyond interfering with the normal functioning of existing game registries,"
+ " blocking system calls / AWT functions,"
+ " obfuscating/deobfuscating parts of minecraft and mod code."
+ " .jar signature invalidation"
+ " and/or deep and irreversible core modifications to the game.");
logger.fatal("A full stacktrace is provided below for debugging purposes.");
logger.fatal(msg, new IllegalStateException(msg));
logger.fatal("========================================================");
} else {
logger.fatal(msg);
}
return;
}
closeRequested = true; closeRequested = true;
try { try {