From 47d818519319b026e4d335a4b21ff0482754e343 Mon Sep 17 00:00:00 2001 From: froot <66188216+kumquat-ir@users.noreply.github.com> Date: Sat, 4 May 2024 16:41:18 -0700 Subject: [PATCH] Remove NuclearCraft ASM (#2467) (cherry picked from commit 43b75c589f84388e70c66a59a879cecfa769be7c) --- .../gregtech/asm/GregTechTransformer.java | 16 ---------- .../NuclearCraftRecipeHelperVisitor.java | 29 ------------------- 2 files changed, 45 deletions(-) delete mode 100644 src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java diff --git a/src/main/java/gregtech/asm/GregTechTransformer.java b/src/main/java/gregtech/asm/GregTechTransformer.java index 005ec295075..4bdf742b499 100644 --- a/src/main/java/gregtech/asm/GregTechTransformer.java +++ b/src/main/java/gregtech/asm/GregTechTransformer.java @@ -1,6 +1,5 @@ package gregtech.asm; -import gregtech.api.util.Mods; import gregtech.asm.util.ObfMapping; import gregtech.asm.util.TargetClassVisitor; import gregtech.asm.visitors.*; @@ -130,21 +129,6 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) classReader.accept(new TargetClassVisitor(classWriter, CCLVisitor.TARGET_METHOD, CCLVisitor::new), 0); return classWriter.toByteArray(); } - case NuclearCraftRecipeHelperVisitor.TARGET_CLASS_NAME: { - ClassReader classReader = new ClassReader(basicClass); - ClassWriter classWriter = new ClassWriter(0); - - // fix NC recipe compat different depending on overhaul vs normal - if (Mods.NuclearCraftOverhauled.isModLoaded()) { - classReader.accept(new TargetClassVisitor(classWriter, - NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NCO, NuclearCraftRecipeHelperVisitor::new), - 0); - } else if (Mods.NuclearCraft.isModLoaded()) { - classReader.accept(new TargetClassVisitor(classWriter, - NuclearCraftRecipeHelperVisitor.TARGET_METHOD_NC, NuclearCraftRecipeHelperVisitor::new), 0); - } - return classWriter.toByteArray(); - } case RenderItemVisitor.TARGET_CLASS_NAME: { ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(basicClass); diff --git a/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java b/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java deleted file mode 100644 index a70986c67fb..00000000000 --- a/src/main/java/gregtech/asm/visitors/NuclearCraftRecipeHelperVisitor.java +++ /dev/null @@ -1,29 +0,0 @@ -package gregtech.asm.visitors; - -import gregtech.asm.util.ObfMapping; - -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -public class NuclearCraftRecipeHelperVisitor extends MethodVisitor implements Opcodes { - - public static final String TARGET_CLASS_NAME = "nc/integration/gtce/GTCERecipeHelper"; - - public static final ObfMapping TARGET_METHOD_NC = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", - "(Ljava/lang/String;Lnc/recipe/ProcessorRecipe;)V"); - public static final ObfMapping TARGET_METHOD_NCO = new ObfMapping(TARGET_CLASS_NAME, "addGTCERecipe", - "(Ljava/lang/String;Lnc/recipe/BasicRecipe;)V"); - - public NuclearCraftRecipeHelperVisitor(MethodVisitor mv) { - super(ASM5, mv); - } - - @Override - public void visitFieldInsn(int opcode, String owner, String name, String desc) { - if (opcode == GETSTATIC && name.equals("FLUID_EXTRACTION_RECIPES")) { // FLUID_EXTRACTION_RECIPES -> - // EXTRACTOR_RECIPES - name = "EXTRACTOR_RECIPES"; - } - super.visitFieldInsn(opcode, owner, name, desc); - } -}