diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-05-21 17:50:43 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-21 12:50:43 +0200 |
commit | ba87b8b1fa4e2397a3e0ed5a18f7ea6137d42f77 (patch) | |
tree | a052e7ac963be0f64980fc3faa664ebf20a52b34 /src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin | |
parent | 1abe65dc3875df5a490d8c900399e61a378ae901 (diff) | |
download | OneConfig-ba87b8b1fa4e2397a3e0ed5a18f7ea6137d42f77.tar.gz OneConfig-ba87b8b1fa4e2397a3e0ed5a18f7ea6137d42f77.tar.bz2 OneConfig-ba87b8b1fa4e2397a3e0ed5a18f7ea6137d42f77.zip |
vigilance compat (#15)
* vigilance compat
reorganize ASM
* remove non-RenderManager nanovg usage wherever possible
fix build
generalize utils
* setupGradle task
* migrate to kotlin gradle
use essential gradle toolkit
shade new gson
* Small changes
* Update .gitignore
* fix natives
* Fix all problems
* null
Co-authored-by: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java | 56 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java | 54 |
2 files changed, 0 insertions, 110 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java deleted file mode 100644 index 8e388dc..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java +++ /dev/null @@ -1,56 +0,0 @@ -package cc.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 - * <a href="https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/">https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/</a> - */ -@SuppressWarnings("unused") -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, "cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider")); - list.add(new InsnNode(Opcodes.DUP)); - list.add(new MethodInsnNode( - Opcodes.INVOKESPECIAL, - "cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider", - "<init>", - "()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/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java deleted file mode 100644 index 6cd8911..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java +++ /dev/null @@ -1,54 +0,0 @@ -package cc.polyfrost.oneconfig.lwjgl.plugin; - -import cc.polyfrost.oneconfig.init.OneConfigInit; -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 - * <a href="https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/">https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/</a> - */ -public class LoadingPlugin implements IFMLLoadingPlugin { - - public LoadingPlugin() { - try { - Field f_exceptions = LaunchClassLoader.class.getDeclaredField("classLoaderExceptions"); - f_exceptions.setAccessible(true); - Set<String> exceptions = (Set<String>) f_exceptions.get(Launch.classLoader); - exceptions.remove("org.lwjgl."); - OneConfigInit.initialize(new String[]{}); - } catch (Exception e) { - throw new RuntimeException("e"); - } - } - - @Override - public String[] getASMTransformerClass() { - return new String[]{"cc.polyfrost.oneconfig.lwjgl.plugin.ClassTransformer"}; - } - - @Override - public String getModContainerClass() { - return null; - } - - @Override - public String getSetupClass() { - return null; - } - - @Override - public void injectData(Map<String, Object> data) { - - } - - @Override - public String getAccessTransformerClass() { - return null; - } -}
\ No newline at end of file |