aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorthedarkcolour <30441001+thedarkcolour@users.noreply.github.com>2019-11-03 20:44:02 -0800
committerthedarkcolour <30441001+thedarkcolour@users.noreply.github.com>2019-11-03 20:44:02 -0800
commitab5a5bb943e70d7f525f023eebb540bf9ee0ffc6 (patch)
tree1420721c7eca880d6460e5f1879999929b8f9599 /src
parentfec27e4794cef10e04ad840e4f9cf2d52031ae52 (diff)
downloadKotlinForForge-ab5a5bb943e70d7f525f023eebb540bf9ee0ffc6.tar.gz
KotlinForForge-ab5a5bb943e70d7f525f023eebb540bf9ee0ffc6.tar.bz2
KotlinForForge-ab5a5bb943e70d7f525f023eebb540bf9ee0ffc6.zip
Adding files
Diffstat (limited to 'src')
-rw-r--r--src/main/resources/patcher.js50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/main/resources/patcher.js b/src/main/resources/patcher.js
deleted file mode 100644
index fcfe312..0000000
--- a/src/main/resources/patcher.js
+++ /dev/null
@@ -1,50 +0,0 @@
-function initializeCoreMod() {
-// Unused, remove
- return {
- 'KotlinPatcher': {
- 'target': {
- 'type': 'METHOD',
- 'class': 'net.minecraftforge.fml.javafmlmod.FMLModContainer',
- 'methodName': 'constructMod',
- 'methodDesc': '(Lnet/minecraftforge/fml/LifecycleEventProvider$LifecycleEvent;)V'
- },
- 'transformer': function (methodNode) {
- var VarInsnNode = Java.type('org.objectweb.asm.tree.VarInsnNode');
- var FieldInsnNode = Java.type('org.objectweb.asm.tree.FieldInsnNode');
- var MethodInsnNode = Java.type('org.objectweb.asm.tree.MethodInsnNode');
- var InsnList = Java.type('org.objectweb.asm.tree.InsnList');
- var Opcodes = Java.type('org.objectweb.asm.Opcodes');
- var list = new InsnList();
- list.add(new FieldInsnNode(Opcodes.GETSTATIC, "thedarkcolour/kotlinforforge/AutoKotlinEventBusSubscriber", "INSTANCE", "Lthedarkcolour/kotlinforforge/AutoKotlinEventBusSubscriber;"));
- list.add(new VarInsnNode(Opcodes.ALOAD, 0));
- list.add(new VarInsnNode(Opcodes.ALOAD, 0));
- list.add(new FieldInsnNode(Opcodes.GETFIELD, 'net/minecraftforge/fml/javafmlmod/FMLModContainer', 'scanResults', 'Lnet/minecraftforge/forgespi/language/ModFileScanData;'));
- list.add(new VarInsnNode(Opcodes.ALOAD, 0));
- list.add(new FieldInsnNode(Opcodes.GETFIELD, 'net/minecraftforge/fml/javafmlmod/FMLModContainer', 'modClass', 'Ljava/lang/Class;'));
- list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, 'java/lang/Class', 'getClassLoader', '()Ljava/lang/ClassLoader;', false));
- list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "thedarkcolour/kotlinforforge/AutoKotlinEventBusSubscriber", "inject", "(Lnet/minecraftforge/fml/ModContainer;Lnet/minecraftforge/forgespi/language/ModFileScanData;Ljava/lang/ClassLoader;)V", false));
-
- for (var i = 0; i < 1000; ++i) {
- var insn = methodNode.instructions.get(i);
- //print('bruh moment');
- if (insn instanceof MethodInsnNode) {
- //print('FOUND A METHODINSNNODE');
- if (insn.desc === '(Lnet/minecraftforge/fml/ModContainer;Lnet/minecraftforge/forgespi/language/ModFileScanData;Ljava/lang/ClassLoader;)V') {
- methodNode.instructions.insertBefore(insn.getPrevious().getPrevious().getPrevious().getPrevious().getPrevious().getPrevious(), list);
- //print('PATCHED FMLMODCONTAINER');
- break;
- }
- }
- }
-
- //var writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
- //methodNode.accept(writer);
- //var reader = new ClassReader(writer.toByteArray());
- //var cn = new ClassNode();
- //reader.accept(cn, 0);
-
- return methodNode;
- }
- }
- }
-} \ No newline at end of file