diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-05-04 17:11:27 +0200 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-05-04 17:11:27 +0200 |
commit | 95cda6817234c2d6fc127922e3a332ac0850274b (patch) | |
tree | 5654b3166889f53609ff9a954e7c9e9cccd3ed5c /src/main | |
parent | 52b2a4533d82a1b3051e9f790a1def9a09b05a8b (diff) | |
parent | d95d62caf21a16b387c24cfecdd9cf7f68d4b54b (diff) | |
download | GT5-Unofficial-95cda6817234c2d6fc127922e3a332ac0850274b.tar.gz GT5-Unofficial-95cda6817234c2d6fc127922e3a332ac0850274b.tar.bz2 GT5-Unofficial-95cda6817234c2d6fc127922e3a332ac0850274b.zip |
Merge branch 'master' of https://github.com/bartimaeusnek/bartworks
Former-commit-id: 5aef62df50970df335776ccf098a30a4f919459a
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index bcc67b18d3..ce5ab6da40 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -39,12 +39,14 @@ public class BWCoreTransformer implements IClassTransformer { public static final String[] DESCRIPTIONFORCONFIG = { "REMOVING RAIN FROM LAST MILLENIUM (EXU)", "REMVOING CREATURES FROM LAST MILLENIUM (EXU)", - "PATCHING GLOBAL RENDERER FOR USE WITH MY GALACTIC DIMS" + "PATCHING GLOBAL RENDERER FOR USE WITH MY GALACTIC DIMS", + "PATCHING THAUMCRAFT WAND PEDESTAL TO PREVENT VIS DUPLICATION", }; public static final String[] CLASSESBEEINGTRANSFORMED = { "com.rwtema.extrautils.worldgen.endoftime.WorldProviderEndOfTime", "com.rwtema.extrautils.worldgen.endoftime.ChunkProviderEndOfTime", "net.minecraft.client.renderer.RenderGlobal", + "thaumcraft.common.tiles.TileWandPedestal", }; public static boolean obfs = false; @@ -70,6 +72,30 @@ public class BWCoreTransformer implements IClassTransformer { // } // } + private static MethodNode transformThaumcraftWandPedestal(MethodNode method) { + InsnList nu = new InsnList(); + for (int j = 0; j < method.instructions.size(); j++) { + AbstractInsnNode instruction = method.instructions.get(j); + nu.add(instruction); + if (instruction.getOpcode() == INVOKEVIRTUAL) { + MethodInsnNode invokevirtual = (MethodInsnNode) instruction; + if (invokevirtual.name.equals("addVis")) { + AbstractInsnNode beginning = method.instructions.get(j - 7); + LabelNode label = new LabelNode(); + nu.insertBefore(beginning, new VarInsnNode(ALOAD, 0)); + nu.insertBefore(beginning, new FieldInsnNode(GETFIELD, "thaumcraft/common/tiles/TileWandPedestal", "field_145850_b" /*"worldObj"*/, "Lnet/minecraft/world/World;")); + nu.insertBefore(beginning, new FieldInsnNode(GETFIELD, "net/minecraft/world/World", "field_72995_K" /*"isRemote"*/, "Z")); + nu.insertBefore(beginning, new JumpInsnNode(IFNE, label)); + nu.add(new InsnNode(POP)); + nu.add(label); + j++; // Skip actual Pop + } + } + } + method.instructions = nu; + return method; + } + public static byte[] transform(int id, byte[] basicClass) { if (!BWCoreTransformer.shouldTransform[id]) { BWCore.BWCORE_LOG.info("Patch: " + DESCRIPTIONFORCONFIG[id] + " is disabled, will not patch!"); @@ -196,6 +222,24 @@ public class BWCoreTransformer implements IClassTransformer { } break; } + case 3: { + BWCore.BWCORE_LOG.info("Could find: " + CLASSESBEEINGTRANSFORMED[id]); + String name_deObfs = "updateEntity"; + String name_src = "func_145845_h"; + String name_Obfs = "h"; + String dsc_universal = "()V"; + + for (int i = 0; i < methods.size(); i++) { + if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs, name_Obfs, name_src) && ASMUtils.isCorrectMethod(methods.get(i), dsc_universal, dsc_universal)) { + BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!"); + MethodNode toPatch = methods.get(i); + toPatch = transformThaumcraftWandPedestal(toPatch); + methods.set(i, toPatch); + break; + } + } + break; + } default: { BWCore.BWCORE_LOG.info("Could not find: " + CLASSESBEEINGTRANSFORMED[id]); return basicClass; |