aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2019-05-04 16:13:09 +0200
committerGitHub <noreply@github.com>2019-05-04 16:13:09 +0200
commitd95d62caf21a16b387c24cfecdd9cf7f68d4b54b (patch)
treec605302cde4d9a6f85394431ec1328f3f7a951eb
parentcbe6cb131f9d2a346adf9b89130fe348f74a7231 (diff)
parentc844dda23e1cff06f5c2517bf03bd11201549c11 (diff)
downloadGT5-Unofficial-d95d62caf21a16b387c24cfecdd9cf7f68d4b54b.tar.gz
GT5-Unofficial-d95d62caf21a16b387c24cfecdd9cf7f68d4b54b.tar.bz2
GT5-Unofficial-d95d62caf21a16b387c24cfecdd9cf7f68d4b54b.zip
Merge pull request #31 from DarkShadow44/thaumcraft-fix
Add thaumcraft wand pedestal fix Former-commit-id: 473243f3ed9cfd184620c269c6dbb409493081f3
-rw-r--r--src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java46
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;