aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorFabian Maurer <dark.shadow4@web.de>2019-05-04 16:02:03 +0200
committerFabian Maurer <dark.shadow4@web.de>2019-05-04 16:02:03 +0200
commitc844dda23e1cff06f5c2517bf03bd11201549c11 (patch)
treec605302cde4d9a6f85394431ec1328f3f7a951eb /src/main
parentcbe6cb131f9d2a346adf9b89130fe348f74a7231 (diff)
downloadGT5-Unofficial-c844dda23e1cff06f5c2517bf03bd11201549c11.tar.gz
GT5-Unofficial-c844dda23e1cff06f5c2517bf03bd11201549c11.tar.bz2
GT5-Unofficial-c844dda23e1cff06f5c2517bf03bd11201549c11.zip
Add thaumcraft wand pedestal fix
We only add the vis into the wand on the server, preventing vis duplication in SP. Former-commit-id: a426a31acbe75d3a2188ab7d9b82b45f9c5c75c8
Diffstat (limited to 'src/main')
-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;