Skip to content

Commit

Permalink
Logging on Display create failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Dec 17, 2024
1 parent 412a831 commit 9fafd98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.fml.common.FMLLog;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
Expand All @@ -21,7 +20,7 @@ public byte[] transform(String s, String s1, byte[] bytes) {
if (s1.startsWith("net.minecraft")) {
ClassReader reader = new ClassReader(bytes);
ClassWriter writer = new ClassWriter(0);
ClassVisitor visitor = new ClassRemapper(writer, new LWJGLXRemapper());
ClassVisitor visitor = new ClassRemapper(writer, INSTANCE);
reader.accept(visitor, 0);
return writer.toByteArray();
}
Expand All @@ -40,7 +39,7 @@ public byte[] transform(String s, String s1, byte[] bytes) {
}
ClassReader lwjglxReader = new ClassReader(lwjglxBytes);
ClassWriter writer = new ClassWriter(0);
ClassVisitor classVisitor = new ClassRemapper(writer, new LWJGLXRemapper());
ClassVisitor classVisitor = new ClassRemapper(writer, INSTANCE);
lwjglxReader.accept(classVisitor, 0);
lwjglxBytes = writer.toByteArray();
if (bytes == null) {
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/org/lwjglx/opengl/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.client.Minecraft;
import net.minecraftforge.common.ForgeEarlyConfig;
import net.minecraftforge.fml.common.FMLLog;
import org.lwjglx.LWJGLException;
import org.lwjglx.input.*;
import org.lwjglx.util.Rectangle;
Expand All @@ -17,10 +18,7 @@
import java.lang.reflect.Modifier;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Optional;
import java.util.*;

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.system.MemoryUtil.NULL;
Expand Down Expand Up @@ -114,7 +112,12 @@ public static void create(PixelFormat pixel_format, ContextAttribs attribs) {

public static void create(PixelFormat pixel_format) {
System.out.println("TODO: Implement Display.create(PixelFormat)"); // TODO
create();
try {
create();
} catch (Throwable t) {
FMLLog.log.info(t.getCause().getMessage());
Arrays.stream(t.getStackTrace()).forEach(FMLLog.log::info);
}
}

public static void create() {
Expand Down

0 comments on commit 9fafd98

Please sign in to comment.