From a0ff501947a84b268e099524a06b56a6b900dad2 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 3 May 2022 18:25:32 +0200 Subject: move to cc.polyfrost --- .../oneconfig/lwjgl/plugin/ClassTransformer.java | 55 ---------------------- .../oneconfig/lwjgl/plugin/LoadingPlugin.java | 52 -------------------- 2 files changed, 107 deletions(-) delete mode 100644 src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java delete mode 100644 src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl/plugin') diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java deleted file mode 100644 index 7dc0d49..0000000 --- a/src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java +++ /dev/null @@ -1,55 +0,0 @@ -package io.polyfrost.oneconfig.lwjgl.plugin; - -import net.minecraft.launchwrapper.IClassTransformer; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.*; - -/** - * Taken from LWJGLTwoPointFive under The Unlicense - * https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/ - */ -public class ClassTransformer implements IClassTransformer { - @Override - public byte[] transform(String name, String transformedName, byte[] basicClass) { - if (name.equals("org.lwjgl.nanovg.NanoVGGLConfig")) { - ClassReader reader = new ClassReader(basicClass); - ClassNode node = new ClassNode(); - reader.accept(node, ClassReader.EXPAND_FRAMES); - - for (MethodNode method : node.methods) { - if (method.name.equals("configGL")) { - InsnList list = new InsnList(); - - list.add(new VarInsnNode(Opcodes.LLOAD, 0)); - list.add(new TypeInsnNode(Opcodes.NEW, "io/polyfrost/oneconfig/lwjgl/Lwjgl2FunctionProvider")); - list.add(new InsnNode(Opcodes.DUP)); - list.add(new MethodInsnNode( - Opcodes.INVOKESPECIAL, - "io/polyfrost/oneconfig/lwjgl/Lwjgl2FunctionProvider", - "", - "()V", - false - )); - list.add(new MethodInsnNode( - Opcodes.INVOKESTATIC, - "org/lwjgl/nanovg/NanoVGGLConfig", - "config", - "(JLorg/lwjgl/system/FunctionProvider;)V", - false - )); - list.add(new InsnNode(Opcodes.RETURN)); - - method.instructions.clear(); - method.instructions.insert(list); - } - } - - ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); - node.accept(cw); - return cw.toByteArray(); - } - return basicClass; - } -} \ No newline at end of file diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java deleted file mode 100644 index b269a2a..0000000 --- a/src/main/java/io/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.polyfrost.oneconfig.lwjgl.plugin; - -import net.minecraft.launchwrapper.Launch; -import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; - -import java.lang.reflect.Field; -import java.util.Map; -import java.util.Set; - -/** - * Taken from LWJGLTwoPointFive under The Unlicense - * https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/ - */ -public class LoadingPlugin implements IFMLLoadingPlugin { - - public LoadingPlugin() { - try { - Field f_exceptions = LaunchClassLoader.class.getDeclaredField("classLoaderExceptions"); - f_exceptions.setAccessible(true); - Set exceptions = (Set) f_exceptions.get(Launch.classLoader); - exceptions.remove("org.lwjgl."); - } catch (Exception e) { - throw new RuntimeException("e"); - } - } - - @Override - public String[] getASMTransformerClass() { - return new String[]{"io.polyfrost.oneconfig.lwjgl.plugin.ClassTransformer"}; - } - - @Override - public String getModContainerClass() { - return null; - } - - @Override - public String getSetupClass() { - return null; - } - - @Override - public void injectData(Map data) { - - } - - @Override - public String getAccessTransformerClass() { - return null; - } -} \ No newline at end of file -- cgit