diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2022-09-04 00:14:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-03 18:14:55 +0200 |
commit | 908d0ccaf9ecb15d97c60b6c8088740c3f53316d (patch) | |
tree | 5e70d92dab8e45d7dae51608aa76aca805a23c02 /src/main/java/gtPlusPlus/preloader | |
parent | 5c58462ba6fd5b5a31b000f05599c7e722091d1e (diff) | |
download | GT5-Unofficial-908d0ccaf9ecb15d97c60b6c8088740c3f53316d.tar.gz GT5-Unofficial-908d0ccaf9ecb15d97c60b6c8088740c3f53316d.tar.bz2 GT5-Unofficial-908d0ccaf9ecb15d97c60b6c8088740c3f53316d.zip |
Remove GT asm (#333)
* remove GT asm
* Spotless apply for branch no-gt-asm for #333 (#334)
Co-authored-by: Glease <4586901+Glease@users.noreply.github.com>
Co-authored-by: GitHub GTNH Actions <>
* Update dependencies.gradle
* Update dependencies.gradle
* Update dependencies.gradle
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gtPlusPlus/preloader')
17 files changed, 0 insertions, 5562 deletions
diff --git a/src/main/java/gtPlusPlus/preloader/asm/helpers/MethodHelper_CC.java b/src/main/java/gtPlusPlus/preloader/asm/helpers/MethodHelper_CC.java deleted file mode 100644 index baffcd5e78..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/helpers/MethodHelper_CC.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.preloader.asm.helpers; - -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import net.minecraft.client.gui.inventory.GuiContainer; - -public class MethodHelper_CC { - - public void mouseUp2(int mousex, int mousey, int button) { - MethodHelper_CC.mouseUp(mousex, mousey, button); - } - - public static void mouseUp(int mousex, int mousey, int button) { - GuiContainerManager aManager = codechicken.nei.guihook.GuiContainerManager.getManager(); - if (aManager != null) { - GuiContainer aWindow = aManager.window; - for (IContainerInputHandler inputhander : GuiContainerManager.inputHandlers) { - // Preloader_Logger.INFO("Found Handler: "+aWindow.getClass().getName() + " | - // "+inputhander.getClass().getName()); - } - for (IContainerInputHandler inputhander : GuiContainerManager.inputHandlers) { - // Preloader_Logger.INFO("Trying to handle events for "+aWindow.getClass().getName() + " | - // "+inputhander.getClass().getName()); - inputhander.onMouseUp(aWindow, mousex, mousey, button); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java b/src/main/java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java deleted file mode 100644 index ab53e93ae7..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.preloader.asm.helpers; - -import gregtech.api.enums.Materials; -import gregtech.api.items.GT_MetaGenerated_Tool; -import java.util.List; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class MethodHelper_GT { - - public static final void getSubItems( - GT_MetaGenerated_Tool aTool, Item var1, CreativeTabs aCreativeTab, List aList) { - for (int i = 0; i < 32766; i += 2) { - if (aTool.getToolStats(new ItemStack(aTool, 1, i)) != null) { - ItemStack tStack = new ItemStack(aTool, 1, i); - aTool.isItemStackUsable(tStack); - aList.add(tStack); - aList.add(aTool.getToolWithStats(i, 1, Materials.TungstenSteel, Materials.TungstenSteel, null)); - aList.add(aTool.getToolWithStats(i, 1, Materials.Neutronium, Materials.Neutronium, null)); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_CC_GuiContainerManager.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_CC_GuiContainerManager.java deleted file mode 100644 index ee463d6cca..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_CC_GuiContainerManager.java +++ /dev/null @@ -1,122 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import gtPlusPlus.preloader.Preloader_Logger; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.*; - -public class ClassTransformer_CC_GuiContainerManager { - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - public ClassTransformer_CC_GuiContainerManager(byte[] basicClass) { - - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - localClassVisitor aTempMethodRemover = new localClassVisitor(aTempWriter); - aTempReader.accept(aTempMethodRemover, 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - - Preloader_Logger.LOG("CodeChicken GuiContainerManager Patch", Level.INFO, "Valid patch? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null) { - Preloader_Logger.LOG("CodeChicken GuiContainerManager Patch", Level.INFO, "Attempting Method Injection."); - injectMethod("mouseUp"); - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName) { - MethodVisitor mv; - boolean didInject = false; - String aClassName = "codechicken/nei/guihook/GuiContainerManager"; - ClassWriter cw = getWriter(); - if (aMethodName.equals("mouseUp")) { - Preloader_Logger.LOG( - "CodeChicken GuiContainerManager Patch", - Level.INFO, - "Injecting " + aMethodName + ", static replacement call to " + aClassName + "."); - mv = cw.visitMethod(ACC_PUBLIC, "mouseUp", "(III)V", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(12, l0); - mv.visitVarInsn(ILOAD, 1); - mv.visitVarInsn(ILOAD, 2); - mv.visitVarInsn(ILOAD, 3); - mv.visitMethodInsn( - INVOKESTATIC, "gtPlusPlus/preloader/asm/helpers/MethodHelper_CC", "mouseUp", "(III)V", false); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(13, l1); - mv.visitInsn(RETURN); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLocalVariable("this", "L+aClassName+;", null, l0, l2, 0); - mv.visitLocalVariable("mousex", "I", null, l0, l2, 1); - mv.visitLocalVariable("mousey", "I", null, l0, l2, 2); - mv.visitLocalVariable("button", "I", null, l0, l2, 3); - mv.visitMaxs(3, 4); - mv.visitEnd(); - didInject = true; - } - - Preloader_Logger.LOG("CodeChicken GuiContainerManager Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public final class localClassVisitor extends ClassVisitor { - - boolean obfuscated = false; - - public localClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - } - - public boolean getObfuscatedRemoval() { - return obfuscated; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - - if (name.equals("mouseUp")) { - methodVisitor = null; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - - if (methodVisitor == null) { - Preloader_Logger.LOG( - "CodeChicken GuiContainerManager Patch", Level.INFO, "Found method " + name + ", removing."); - Preloader_Logger.LOG("CodeChicken GuiContainerManager Patch", Level.INFO, "Descriptor: " + desc); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_EntityLivingBase_SetHealth.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_EntityLivingBase_SetHealth.java deleted file mode 100644 index e3821e8865..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Forge_EntityLivingBase_SetHealth.java +++ /dev/null @@ -1,109 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.DamageSource; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -public class ClassTransformer_Forge_EntityLivingBase_SetHealth { - - private boolean isValid = false; - private ClassReader mReader = null; - private ClassWriter mWriter = null; - private boolean didPatch = false; - - public ClassTransformer_Forge_EntityLivingBase_SetHealth(String aClassName, byte[] basicClass) { - if (basicClass == null) { - return; - } - - ClassReader reader = new ClassReader(basicClass); - ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS); - ClassVisitor visitor = writer; - SetHealthVisitor aVisitor = new SetHealthVisitor(visitor); - visitor = aVisitor; - reader.accept(visitor, 0); - if (reader != null && writer != null) { - isValid = true; - } else { - isValid = false; - } - mReader = reader; - mWriter = writer; - didPatch = aVisitor.didPatchInternal; - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return mReader; - } - - public ClassWriter getWriter() { - return mWriter; - } - - public static class SetHealthVisitor extends ClassVisitor { - private String clsName = null; - private boolean didPatchInternal = false; - private static final String callbackOwner = org.objectweb.asm.Type.getInternalName(SetHealthVisitor.class); - - private SetHealthVisitor(ClassVisitor cv) { - super(Opcodes.ASM5, cv); - } - - @Override - public void visit( - int version, int access, String name, String signature, String superName, String[] interfaces) { - super.visit(version, access, name, signature, superName, interfaces); - this.clsName = name; - } - - @Override - public MethodVisitor visitMethod( - int mAccess, final String mName, final String mDesc, String mSignature, String[] mExceptions) { - final boolean warn = !(clsName.equals("net/minecraft/entity/EntityLivingBase")); - - return new MethodVisitor(Opcodes.ASM5, super.visitMethod(mAccess, mName, mDesc, mSignature, mExceptions)) { - @Override - public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean isIntf) { - if (owner.equals("net/minecraft/entity/EntityLivingBase") - && name.equals("setHealth") - && desc.equals("(F)V")) { - if (warn) { - FMLRelaunchLog.warning("============================================================="); - FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE Entity.setHealth() THIS IS NOT ALLOWED!"); - FMLRelaunchLog.warning("Offendor: %s.%s%s", SetHealthVisitor.this.clsName, mName, mDesc); - FMLRelaunchLog.warning( - "Use EntityLiving.attackEntityFrom(DamageSource, damageDealt) instead"); - FMLRelaunchLog.warning("============================================================="); - } - didPatchInternal = true; - // opcode = Opcodes.INVOKESTATIC; // Set it static - // owner = SetHealthVisitor.callbackOwner; - // name = "setHealthGeneric"; // Replace the method name - // desc = "(Lnet/minecraft/entity/EntityLivingBase;F)V"; // Replace the method desc - - } - super.visitMethodInsn(opcode, owner, name, desc, isIntf); - } - }; - } - - private static final DamageSource mGenericDamageSource = new DamageSource("gtpp.generic"); - - public static void setHealthGeneric(EntityLivingBase aEntity, float aValue) { - aEntity.attackEntityFrom(mGenericDamageSource, aValue); - } - } - - public boolean didPatchClass() { - return didPatch; - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Achievements.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Achievements.java deleted file mode 100644 index 0ee90e43a7..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Achievements.java +++ /dev/null @@ -1,2452 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_Achievements { - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - private static boolean mDidRemoveAssLineRecipeAdder = false; - - public ClassTransformer_GT_Achievements(byte[] basicClass) { - - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - - aTempReader.accept(new MethodAdaptor(aTempWriter), 0); - - if (mDidRemoveAssLineRecipeAdder) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Patching GT .09"); - injectMethod(aTempWriter); - patchOnItemPickup09(aTempWriter); - } else { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Patching GT .08"); - patchOnItemPickup08(aTempWriter); - } - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Valid? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(ClassWriter cw) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Injecting " + "registerAssAchievement" + "."); - - /** - * Inject new, safer code - */ - - /*mv = cw.visitMethod(ACC_PUBLIC, "registerAssAchievement", "(Lgregtech/api/util/GT_Recipe;)Lnet/minecraft/stats/Achievement;", null, null); - mv.visitCode(); - Label l0 = new Label(); - Label l1 = new Label(); - Label l2 = new Label(); - mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable"); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLineNumber(291, l3); - mv.visitVarInsn(ALOAD, 1); - Label l4 = new Label(); - mv.visitJumpInsn(IFNONNULL, l4); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(292, l5); - mv.visitLdcInsn("Someone tried to register an achievement for an invalid recipe. Please report this to Alkalus."); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/api/objects/Logger", "INFO", "(Ljava/lang/String;)V", false); - Label l6 = new Label(); - mv.visitLabel(l6); - mv.visitLineNumber(293, l6); - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - mv.visitLabel(l4); - mv.visitLineNumber(295, l4); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 1); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn(INVOKEVIRTUAL, "gregtech/api/util/GT_Recipe", "getOutput", "(I)Lnet/minecraft/item/ItemStack;", false); - Label l7 = new Label(); - mv.visitJumpInsn(IFNONNULL, l7); - Label l8 = new Label(); - mv.visitLabel(l8); - mv.visitLineNumber(296, l8); - mv.visitLdcInsn("Someone tried to register an achievement for a recipe with null output. Please report this to Alkalus."); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/api/objects/Logger", "INFO", "(Ljava/lang/String;)V", false); - Label l9 = new Label(); - mv.visitLabel(l9); - mv.visitLineNumber(297, l9); - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - mv.visitLabel(l7); - mv.visitLineNumber(299, l7); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 1); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn(INVOKEVIRTUAL, "gregtech/api/util/GT_Recipe", "getOutput", "(I)Lnet/minecraft/item/ItemStack;", false); - mv.visitVarInsn(ASTORE, 3); - mv.visitLabel(l0); - mv.visitLineNumber(301, l0); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitVarInsn(ASTORE, 2); - mv.visitLabel(l1); - mv.visitLineNumber(302, l1); - Label l10 = new Label(); - mv.visitJumpInsn(GOTO, l10); - mv.visitLabel(l2); - mv.visitLineNumber(303, l2); - mv.visitFrame(F_FULL, 4, new Object[] {"gregtech/loaders/misc/GT_Achievements", "gregtech/api/util/GT_Recipe", TOP, "net/minecraft/item/ItemStack"}, 1, new Object[] {"java/lang/Throwable"}); - mv.visitVarInsn(ASTORE, 4); - Label l11 = new Label(); - mv.visitLabel(l11); - mv.visitLineNumber(304, l11); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/core/util/minecraft/ItemUtils", "getUnlocalizedItemName", "(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;", false); - mv.visitVarInsn(ASTORE, 2); - mv.visitLabel(l10); - mv.visitLineNumber(306, l10); - mv.visitFrame(F_FULL, 4, new Object[] {"gregtech/loaders/misc/GT_Achievements", "gregtech/api/util/GT_Recipe", "java/lang/String", "net/minecraft/item/ItemStack"}, 0, new Object[] {}); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/loaders/misc/GT_Achievements", "achievementList", "Ljava/util/concurrent/ConcurrentHashMap;"); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/concurrent/ConcurrentHashMap", "get", "(Ljava/lang/Object;)Ljava/lang/Object;", false); - Label l12 = new Label(); - mv.visitJumpInsn(IFNONNULL, l12); - Label l13 = new Label(); - mv.visitLabel(l13); - mv.visitLineNumber(307, l13); - mv.visitFieldInsn(GETSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - mv.visitInsn(ICONST_1); - mv.visitInsn(IADD); - mv.visitFieldInsn(PUTSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - Label l14 = new Label(); - mv.visitLabel(l14); - mv.visitLineNumber(308, l14); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitIntInsn(BIPUSH, 11); - mv.visitFieldInsn(GETSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - mv.visitInsn(ICONST_5); - mv.visitInsn(IREM); - mv.visitInsn(IADD); - mv.visitInsn(INEG); - mv.visitFieldInsn(GETSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - mv.visitInsn(ICONST_5); - mv.visitInsn(IDIV); - mv.visitIntInsn(BIPUSH, 8); - mv.visitInsn(ISUB); - mv.visitVarInsn(ALOAD, 1); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn(INVOKEVIRTUAL, "gregtech/api/util/GT_Recipe", "getOutput", "(I)Lnet/minecraft/item/ItemStack;", false); - mv.visitFieldInsn(GETSTATIC, "net/minecraft/stats/AchievementList", "openInventory", "Lnet/minecraft/stats/Achievement;"); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn(INVOKEVIRTUAL, "gregtech/loaders/misc/GT_Achievements", "registerAchievement", "(Ljava/lang/String;IILnet/minecraft/item/ItemStack;Lnet/minecraft/stats/Achievement;Z)Lnet/minecraft/stats/Achievement;", false); - mv.visitInsn(ARETURN); - mv.visitLabel(l12); - mv.visitLineNumber(310, l12); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - Label l15 = new Label(); - mv.visitLabel(l15); - mv.visitLocalVariable("this", "Lgregtech/loaders/misc/GT_Achievements;", null, l3, l15, 0); - mv.visitLocalVariable("recipe", "Lgregtech/api/util/GT_Recipe;", null, l3, l15, 1); - mv.visitLocalVariable("aSafeUnlocalName", "Ljava/lang/String;", null, l1, l2, 2); - mv.visitLocalVariable("aSafeUnlocalName", "Ljava/lang/String;", null, l10, l15, 2); - mv.visitLocalVariable("aStack", "Lnet/minecraft/item/ItemStack;", null, l0, l15, 3); - mv.visitLocalVariable("t", "Ljava/lang/Throwable;", null, l11, l10, 4); - mv.visitMaxs(7, 5); - mv.visitEnd();*/ - - // Lets just static call my replacement function - mv = cw.visitMethod( - ACC_PUBLIC, - "registerAssAchievement", - "(Lgregtech/api/util/GT_Recipe;)Lnet/minecraft/stats/Achievement;", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(291, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/xmod/gregtech/loaders/misc/AssLineAchievements", - "registerAssAchievement", - "(Lgregtech/api/util/GT_Recipe;)Lnet/minecraft/stats/Achievement;", - false); - mv.visitInsn(ARETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "Lgregtech/loaders/misc/GT_Achievements;", null, l0, l1, 0); - mv.visitLocalVariable("recipe", "Lgregtech/api/util/GT_Recipe;", null, l0, l1, 1); - mv.visitMaxs(1, 2); - mv.visitEnd(); - - didInject = true; - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public boolean patchOnItemPickup08(ClassWriter cw) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Injecting " + "onItemPickup" + "."); - - AnnotationVisitor av0; - mv = cw.visitMethod( - ACC_PUBLIC, - "onItemPickup", - "(Lnet/minecraftforge/event/entity/player/EntityItemPickupEvent;)V", - null, - null); - av0 = mv.visitAnnotation("Lcpw/mods/fml/common/eventhandler/SubscribeEvent;", true); - av0.visitEnd(); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(418, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/event/entity/player/EntityItemPickupEvent", - "entityPlayer", - "Lnet/minecraft/entity/player/EntityPlayer;"); - mv.visitVarInsn(ASTORE, 2); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(419, l1); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/event/entity/player/EntityItemPickupEvent", - "item", - "Lnet/minecraft/entity/item/EntityItem;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "net/minecraft/entity/item/EntityItem", - "getEntityItem", - "()Lnet/minecraft/item/ItemStack;", - false); - mv.visitVarInsn(ASTORE, 3); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(420, l2); - mv.visitVarInsn(ALOAD, 2); - Label l3 = new Label(); - mv.visitJumpInsn(IFNULL, l3); - mv.visitVarInsn(ALOAD, 3); - Label l4 = new Label(); - mv.visitJumpInsn(IFNONNULL, l4); - mv.visitLabel(l3); - mv.visitLineNumber(421, l3); - mv.visitFrame( - F_APPEND, - 2, - new Object[] {"net/minecraft/entity/player/EntityPlayer", "net/minecraft/item/ItemStack"}, - 0, - null); - mv.visitInsn(RETURN); - mv.visitLabel(l4); - mv.visitLineNumber(424, l4); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKESTATIC, - "gregtech/api/util/GT_OreDictUnificator", - "getItemData", - "(Lnet/minecraft/item/ItemStack;)Lgregtech/api/objects/ItemData;", - false); - mv.visitVarInsn(ASTORE, 4); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(425, l5); - mv.visitVarInsn(ALOAD, 4); - Label l6 = new Label(); - mv.visitJumpInsn(IFNULL, l6); - Label l7 = new Label(); - mv.visitLabel(l7); - mv.visitLineNumber(426, l7); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "dust", "Lgregtech/api/enums/OrePrefixes;"); - Label l8 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l8); - Label l9 = new Label(); - mv.visitLabel(l9); - mv.visitLineNumber(427, l9); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/ItemData", "mMaterial", "Lgregtech/api/objects/MaterialStack;"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Lutetium", "Lgregtech/api/enums/Materials;"); - Label l10 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l10); - Label l11 = new Label(); - mv.visitLabel(l11); - mv.visitLineNumber(428, l11); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("newmetal"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l10); - mv.visitLineNumber(430, l10); - mv.visitFrame(F_APPEND, 1, new Object[] {"gregtech/api/objects/ItemData"}, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("cleandust"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l12 = new Label(); - mv.visitLabel(l12); - mv.visitLineNumber(431, l12); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l8); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "ore", "Lgregtech/api/enums/OrePrefixes;"); - Label l13 = new Label(); - mv.visitJumpInsn(IF_ACMPEQ, l13); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "oreBlackgranite", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitJumpInsn(IF_ACMPEQ, l13); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "oreEndstone", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitJumpInsn(IF_ACMPEQ, l13); - Label l14 = new Label(); - mv.visitLabel(l14); - mv.visitLineNumber(432, l14); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "oreNetherrack", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitJumpInsn(IF_ACMPEQ, l13); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "oreRedgranite", "Lgregtech/api/enums/OrePrefixes;"); - Label l15 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l15); - mv.visitLabel(l13); - mv.visitLineNumber(433, l13); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(ICONST_0); - mv.visitVarInsn(ISTORE, 5); - Label l16 = new Label(); - mv.visitLabel(l16); - Label l17 = new Label(); - mv.visitJumpInsn(GOTO, l17); - Label l18 = new Label(); - mv.visitLabel(l18); - mv.visitLineNumber(434, l18); - mv.visitFrame(F_APPEND, 1, new Object[] {INTEGER}, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitVarInsn(ILOAD, 5); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "get", "(I)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/objects/MaterialStack"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitMethodInsn(INVOKEVIRTUAL, "gregtech/api/enums/Materials", "name", "()Ljava/lang/String;", false); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l19 = new Label(); - mv.visitLabel(l19); - mv.visitLineNumber(435, l19); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitVarInsn(ILOAD, 5); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "get", "(I)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/objects/MaterialStack"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "AnyIron", "Lgregtech/api/enums/Materials;"); - Label l20 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l20); - Label l21 = new Label(); - mv.visitLabel(l21); - mv.visitLineNumber(436, l21); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("iron"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l20); - mv.visitLineNumber(433, l20); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitIincInsn(5, 1); - mv.visitLabel(l17); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ILOAD, 5); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "size", "()I", false); - mv.visitJumpInsn(IF_ICMPLT, l18); - Label l22 = new Label(); - mv.visitLabel(l22); - mv.visitLineNumber(439, l22); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l15); - mv.visitFrame(F_CHOP, 1, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "crushed", "Lgregtech/api/enums/OrePrefixes;"); - Label l23 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l23); - Label l24 = new Label(); - mv.visitLabel(l24); - mv.visitLineNumber(440, l24); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("crushed"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l25 = new Label(); - mv.visitLabel(l25); - mv.visitLineNumber(441, l25); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l23); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "crushedPurified", "Lgregtech/api/enums/OrePrefixes;"); - Label l26 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l26); - Label l27 = new Label(); - mv.visitLabel(l27); - mv.visitLineNumber(442, l27); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("washing"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l28 = new Label(); - mv.visitLabel(l28); - mv.visitLineNumber(443, l28); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l26); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "crushedCentrifuged", "Lgregtech/api/enums/OrePrefixes;"); - Label l29 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l29); - Label l30 = new Label(); - mv.visitLabel(l30); - mv.visitLineNumber(444, l30); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("spinit"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l31 = new Label(); - mv.visitLabel(l31); - mv.visitLineNumber(445, l31); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l29); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/ItemData", "mMaterial", "Lgregtech/api/objects/MaterialStack;"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Steel", "Lgregtech/api/enums/Materials;"); - Label l32 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l32); - Label l33 = new Label(); - mv.visitLabel(l33); - mv.visitLineNumber(446, l33); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "ingot", "Lgregtech/api/enums/OrePrefixes;"); - Label l34 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l34); - mv.visitVarInsn(ALOAD, 3); - mv.visitFieldInsn(GETFIELD, "net/minecraft/item/ItemStack", "stackSize", "I"); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getMaxStackSize", "()I", false); - mv.visitJumpInsn(IF_ICMPNE, l34); - Label l35 = new Label(); - mv.visitLabel(l35); - mv.visitLineNumber(447, l35); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("steel"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l36 = new Label(); - mv.visitLabel(l36); - mv.visitLineNumber(448, l36); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l34); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "nugget", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitJumpInsn(IF_ACMPNE, l6); - mv.visitLdcInsn("Thaumcraft"); - mv.visitMethodInsn(INVOKESTATIC, "cpw/mods/fml/common/Loader", "isModLoaded", "(Ljava/lang/String;)Z", false); - mv.visitJumpInsn(IFEQ, l6); - Label l37 = new Label(); - mv.visitLabel(l37); - mv.visitLineNumber(449, l37); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "net/minecraft/entity/player/EntityPlayer", - "getDisplayName", - "()Ljava/lang/String;", - false); - mv.visitLdcInsn("GT_IRON_TO_STEEL"); - mv.visitMethodInsn( - INVOKESTATIC, - "thaumcraft/api/ThaumcraftApiHelper", - "isResearchComplete", - "(Ljava/lang/String;Ljava/lang/String;)Z", - false); - mv.visitJumpInsn(IFEQ, l6); - Label l38 = new Label(); - mv.visitLabel(l38); - mv.visitLineNumber(450, l38); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("steel"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l39 = new Label(); - mv.visitLabel(l39); - mv.visitLineNumber(453, l39); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l32); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "circuit", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitJumpInsn(IF_ACMPNE, l6); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/ItemData", "mMaterial", "Lgregtech/api/objects/MaterialStack;"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Advanced", "Lgregtech/api/enums/Materials;"); - mv.visitJumpInsn(IF_ACMPNE, l6); - Label l40 = new Label(); - mv.visitLabel(l40); - mv.visitLineNumber(454, l40); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("stepforward"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l6); - mv.visitLineNumber(457, l6); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem."); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "startsWith", "(Ljava/lang/String;)Z", false); - Label l41 = new Label(); - mv.visitJumpInsn(IFEQ, l41); - Label l42 = new Label(); - mv.visitLabel(l42); - mv.visitLineNumber(458, l42); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32500"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l43 = new Label(); - mv.visitJumpInsn(IFEQ, l43); - Label l44 = new Label(); - mv.visitLabel(l44); - mv.visitLineNumber(459, l44); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestlead"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l45 = new Label(); - mv.visitLabel(l45); - mv.visitLineNumber(460, l45); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l43); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32501"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l46 = new Label(); - mv.visitJumpInsn(IFEQ, l46); - Label l47 = new Label(); - mv.visitLabel(l47); - mv.visitLineNumber(461, l47); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestsilver"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l48 = new Label(); - mv.visitLabel(l48); - mv.visitLineNumber(462, l48); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l46); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32503"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l49 = new Label(); - mv.visitJumpInsn(IFEQ, l49); - Label l50 = new Label(); - mv.visitLabel(l50); - mv.visitLineNumber(463, l50); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestiron"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l51 = new Label(); - mv.visitLabel(l51); - mv.visitLineNumber(464, l51); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l49); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32504"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l52 = new Label(); - mv.visitJumpInsn(IFEQ, l52); - Label l53 = new Label(); - mv.visitLabel(l53); - mv.visitLineNumber(465, l53); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestgold"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l54 = new Label(); - mv.visitLabel(l54); - mv.visitLineNumber(466, l54); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l52); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32530"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l55 = new Label(); - mv.visitJumpInsn(IFEQ, l55); - Label l56 = new Label(); - mv.visitLabel(l56); - mv.visitLineNumber(467, l56); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestcopper"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l57 = new Label(); - mv.visitLabel(l57); - mv.visitLineNumber(468, l57); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l55); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32540"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l58 = new Label(); - mv.visitJumpInsn(IFEQ, l58); - Label l59 = new Label(); - mv.visitLabel(l59); - mv.visitLineNumber(469, l59); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havesttin"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l60 = new Label(); - mv.visitLabel(l60); - mv.visitLineNumber(470, l60); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l58); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32510"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l61 = new Label(); - mv.visitJumpInsn(IFEQ, l61); - Label l62 = new Label(); - mv.visitLabel(l62); - mv.visitLineNumber(471, l62); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestoil"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l63 = new Label(); - mv.visitLabel(l63); - mv.visitLineNumber(472, l63); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l61); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32511"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l64 = new Label(); - mv.visitJumpInsn(IFEQ, l64); - Label l65 = new Label(); - mv.visitLabel(l65); - mv.visitLineNumber(473, l65); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestemeralds"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l66 = new Label(); - mv.visitLabel(l66); - mv.visitLineNumber(474, l66); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l64); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32706"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l67 = new Label(); - mv.visitJumpInsn(IFEQ, l67); - Label l68 = new Label(); - mv.visitLabel(l68); - mv.visitLineNumber(475, l68); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("energyflow"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l69 = new Label(); - mv.visitLabel(l69); - mv.visitLineNumber(476, l69); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l67); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32702"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l70 = new Label(); - mv.visitJumpInsn(IFEQ, l70); - Label l71 = new Label(); - mv.visitLabel(l71); - mv.visitLineNumber(477, l71); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("bettercircuits"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l72 = new Label(); - mv.visitLabel(l72); - mv.visitLineNumber(478, l72); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l70); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32707"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l73 = new Label(); - mv.visitJumpInsn(IFEQ, l73); - Label l74 = new Label(); - mv.visitLabel(l74); - mv.visitLineNumber(479, l74); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("datasaving"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l75 = new Label(); - mv.visitLabel(l75); - mv.visitLineNumber(480, l75); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l73); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32597"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l76 = new Label(); - mv.visitJumpInsn(IFEQ, l76); - Label l77 = new Label(); - mv.visitLabel(l77); - mv.visitLineNumber(481, l77); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("orbs"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l78 = new Label(); - mv.visitLabel(l78); - mv.visitLineNumber(482, l78); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l76); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32599"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l79 = new Label(); - mv.visitJumpInsn(IFEQ, l79); - Label l80 = new Label(); - mv.visitLabel(l80); - mv.visitLineNumber(483, l80); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("thatspower"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l81 = new Label(); - mv.visitLabel(l81); - mv.visitLineNumber(484, l81); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l79); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32598"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l82 = new Label(); - mv.visitJumpInsn(IFEQ, l82); - Label l83 = new Label(); - mv.visitLabel(l83); - mv.visitLineNumber(485, l83); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("luck"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l84 = new Label(); - mv.visitLabel(l84); - mv.visitLineNumber(486, l84); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l82); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32749"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l85 = new Label(); - mv.visitJumpInsn(IFEQ, l85); - Label l86 = new Label(); - mv.visitLabel(l86); - mv.visitLineNumber(487, l86); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("closeit"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l87 = new Label(); - mv.visitLabel(l87); - mv.visitLineNumber(488, l87); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l85); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32730"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l88 = new Label(); - mv.visitJumpInsn(IFEQ, l88); - Label l89 = new Label(); - mv.visitLabel(l89); - mv.visitLineNumber(489, l89); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("manipulation"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l90 = new Label(); - mv.visitLabel(l90); - mv.visitLineNumber(490, l90); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l88); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32729"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l91 = new Label(); - mv.visitJumpInsn(IFEQ, l91); - Label l92 = new Label(); - mv.visitLabel(l92); - mv.visitLineNumber(491, l92); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("filterregulate"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l93 = new Label(); - mv.visitLabel(l93); - mv.visitLineNumber(492, l93); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l91); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32605"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l94 = new Label(); - mv.visitJumpInsn(IFEQ, l94); - Label l95 = new Label(); - mv.visitLabel(l95); - mv.visitLineNumber(493, l95); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("whatnow"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l96 = new Label(); - mv.visitLabel(l96); - mv.visitLineNumber(494, l96); - mv.visitJumpInsn(GOTO, l41); - mv.visitLabel(l94); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.Thoriumcell"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - mv.visitJumpInsn(IFEQ, l41); - Label l97 = new Label(); - mv.visitLabel(l97); - mv.visitLineNumber(495, l97); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("newfuel"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l41); - mv.visitLineNumber(498, l41); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(RETURN); - Label l98 = new Label(); - mv.visitLabel(l98); - mv.visitLocalVariable("this", "Lgregtech/loaders/misc/GT_Achievements;", null, l0, l98, 0); - mv.visitLocalVariable( - "event", "Lnet/minecraftforge/event/entity/player/EntityItemPickupEvent;", null, l0, l98, 1); - mv.visitLocalVariable("player", "Lnet/minecraft/entity/player/EntityPlayer;", null, l1, l98, 2); - mv.visitLocalVariable("stack", "Lnet/minecraft/item/ItemStack;", null, l2, l98, 3); - mv.visitLocalVariable("data", "Lgregtech/api/objects/ItemData;", null, l5, l98, 4); - mv.visitLocalVariable("i", "I", null, l16, l22, 5); - mv.visitMaxs(4, 6); - mv.visitEnd(); - - didInject = true; - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public boolean patchOnItemPickup09(ClassWriter cw) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Injecting " + "onItemPickup" + "."); - - /** - * Inject new, safer code - */ - AnnotationVisitor av0; - mv = cw.visitMethod( - ACC_PUBLIC, - "onItemPickup", - "(Lnet/minecraftforge/event/entity/player/EntityItemPickupEvent;)V", - null, - null); - av0 = mv.visitAnnotation("Lcpw/mods/fml/common/eventhandler/SubscribeEvent;", true); - av0.visitEnd(); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(546, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/event/entity/player/EntityItemPickupEvent", - "entityPlayer", - "Lnet/minecraft/entity/player/EntityPlayer;"); - mv.visitVarInsn(ASTORE, 2); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(547, l1); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/event/entity/player/EntityItemPickupEvent", - "item", - "Lnet/minecraft/entity/item/EntityItem;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "net/minecraft/entity/item/EntityItem", - "getEntityItem", - "()Lnet/minecraft/item/ItemStack;", - false); - mv.visitVarInsn(ASTORE, 3); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(548, l2); - mv.visitVarInsn(ALOAD, 2); - Label l3 = new Label(); - mv.visitJumpInsn(IFNULL, l3); - mv.visitVarInsn(ALOAD, 3); - Label l4 = new Label(); - mv.visitJumpInsn(IFNONNULL, l4); - mv.visitLabel(l3); - mv.visitLineNumber(549, l3); - mv.visitFrame( - F_APPEND, - 2, - new Object[] {"net/minecraft/entity/player/EntityPlayer", "net/minecraft/item/ItemStack"}, - 0, - null); - mv.visitInsn(RETURN); - mv.visitLabel(l4); - mv.visitLineNumber(551, l4); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKESTATIC, - "gregtech/api/util/GT_OreDictUnificator", - "getItemData", - "(Lnet/minecraft/item/ItemStack;)Lgregtech/api/objects/ItemData;", - false); - mv.visitVarInsn(ASTORE, 4); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(552, l5); - mv.visitVarInsn(ALOAD, 4); - Label l6 = new Label(); - mv.visitJumpInsn(IFNULL, l6); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitJumpInsn(IFNULL, l6); - Label l7 = new Label(); - mv.visitLabel(l7); - mv.visitLineNumber(553, l7); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "dust", "Lgregtech/api/enums/OrePrefixes;"); - Label l8 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l8); - Label l9 = new Label(); - mv.visitLabel(l9); - mv.visitLineNumber(554, l9); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/ItemData", "mMaterial", "Lgregtech/api/objects/MaterialStack;"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Lutetium", "Lgregtech/api/enums/Materials;"); - Label l10 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l10); - Label l11 = new Label(); - mv.visitLabel(l11); - mv.visitLineNumber(555, l11); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("newmetal"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l10); - mv.visitLineNumber(557, l10); - mv.visitFrame(F_APPEND, 1, new Object[] {"gregtech/api/objects/ItemData"}, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/ItemData", "mMaterial", "Lgregtech/api/objects/MaterialStack;"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Gunpowder", "Lgregtech/api/enums/Materials;"); - mv.visitJumpInsn(IF_ACMPEQ, l6); - Label l12 = new Label(); - mv.visitLabel(l12); - mv.visitLineNumber(558, l12); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("cleandust"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l13 = new Label(); - mv.visitLabel(l13); - mv.visitLineNumber(560, l13); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l8); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitMethodInsn(INVOKEVIRTUAL, "gregtech/api/enums/OrePrefixes", "name", "()Ljava/lang/String;", false); - mv.visitLdcInsn("ore"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "startsWith", "(Ljava/lang/String;)Z", false); - Label l14 = new Label(); - mv.visitJumpInsn(IFEQ, l14); - Label l15 = new Label(); - mv.visitLabel(l15); - mv.visitLineNumber(561, l15); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "size", "()I", false); - mv.visitVarInsn(ISTORE, 5); - Label l16 = new Label(); - mv.visitLabel(l16); - mv.visitLineNumber(562, l16); - mv.visitInsn(ICONST_0); - mv.visitVarInsn(ISTORE, 6); - Label l17 = new Label(); - mv.visitLabel(l17); - Label l18 = new Label(); - mv.visitJumpInsn(GOTO, l18); - Label l19 = new Label(); - mv.visitLabel(l19); - mv.visitLineNumber(563, l19); - mv.visitFrame(F_APPEND, 2, new Object[] {INTEGER, INTEGER}, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitVarInsn(ILOAD, 6); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "get", "(I)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/objects/MaterialStack"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETFIELD, "gregtech/api/enums/Materials", "mName", "Ljava/lang/String;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l20 = new Label(); - mv.visitLabel(l20); - mv.visitLineNumber(564, l20); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitVarInsn(ILOAD, 6); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "get", "(I)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/objects/MaterialStack"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Iron", "Lgregtech/api/enums/Materials;"); - Label l21 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l21); - Label l22 = new Label(); - mv.visitLabel(l22); - mv.visitLineNumber(565, l22); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("iron"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l21); - mv.visitLineNumber(567, l21); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitVarInsn(ILOAD, 6); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "get", "(I)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/objects/MaterialStack"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Copper", "Lgregtech/api/enums/Materials;"); - Label l23 = new Label(); - mv.visitJumpInsn(IF_ACMPEQ, l23); - mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/objects/ItemData", - "getAllMaterialStacks", - "()Ljava/util/ArrayList;", - false); - mv.visitVarInsn(ILOAD, 6); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "get", "(I)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/objects/MaterialStack"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Tin", "Lgregtech/api/enums/Materials;"); - Label l24 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l24); - mv.visitLabel(l23); - mv.visitLineNumber(568, l23); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn( - GETFIELD, - "net/minecraftforge/event/entity/player/EntityItemPickupEvent", - "entityPlayer", - "Lnet/minecraft/entity/player/EntityPlayer;"); - mv.visitLdcInsn("mineOre"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l24); - mv.visitLineNumber(562, l24); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitIincInsn(6, 1); - mv.visitLabel(l18); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ILOAD, 6); - mv.visitVarInsn(ILOAD, 5); - mv.visitJumpInsn(IF_ICMPLT, l19); - Label l25 = new Label(); - mv.visitLabel(l25); - mv.visitLineNumber(572, l25); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l14); - mv.visitFrame(F_CHOP, 2, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "crushed", "Lgregtech/api/enums/OrePrefixes;"); - Label l26 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l26); - Label l27 = new Label(); - mv.visitLabel(l27); - mv.visitLineNumber(573, l27); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("crushed"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l28 = new Label(); - mv.visitLabel(l28); - mv.visitLineNumber(574, l28); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l26); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "crushedPurified", "Lgregtech/api/enums/OrePrefixes;"); - Label l29 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l29); - Label l30 = new Label(); - mv.visitLabel(l30); - mv.visitLineNumber(575, l30); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("washing"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l31 = new Label(); - mv.visitLabel(l31); - mv.visitLineNumber(576, l31); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l29); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn( - GETSTATIC, "gregtech/api/enums/OrePrefixes", "crushedCentrifuged", "Lgregtech/api/enums/OrePrefixes;"); - Label l32 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l32); - Label l33 = new Label(); - mv.visitLabel(l33); - mv.visitLineNumber(577, l33); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("spinit"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l34 = new Label(); - mv.visitLabel(l34); - mv.visitLineNumber(578, l34); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l32); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/ItemData", "mMaterial", "Lgregtech/api/objects/MaterialStack;"); - mv.visitFieldInsn( - GETFIELD, "gregtech/api/objects/MaterialStack", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/Materials", "Steel", "Lgregtech/api/enums/Materials;"); - mv.visitJumpInsn(IF_ACMPNE, l6); - Label l35 = new Label(); - mv.visitLabel(l35); - mv.visitLineNumber(579, l35); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "ingot", "Lgregtech/api/enums/OrePrefixes;"); - Label l36 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l36); - mv.visitVarInsn(ALOAD, 3); - mv.visitFieldInsn(GETFIELD, "net/minecraft/item/ItemStack", "stackSize", "I"); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getMaxStackSize", "()I", false); - mv.visitJumpInsn(IF_ICMPNE, l36); - Label l37 = new Label(); - mv.visitLabel(l37); - mv.visitLineNumber(580, l37); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("steel"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l38 = new Label(); - mv.visitLabel(l38); - mv.visitLineNumber(581, l38); - mv.visitJumpInsn(GOTO, l6); - mv.visitLabel(l36); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitFieldInsn(GETFIELD, "gregtech/api/objects/ItemData", "mPrefix", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/enums/OrePrefixes", "nugget", "Lgregtech/api/enums/OrePrefixes;"); - mv.visitJumpInsn(IF_ACMPNE, l6); - mv.visitLdcInsn("Thaumcraft"); - mv.visitMethodInsn(INVOKESTATIC, "cpw/mods/fml/common/Loader", "isModLoaded", "(Ljava/lang/String;)Z", false); - mv.visitJumpInsn(IFEQ, l6); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "net/minecraft/entity/player/EntityPlayer", - "getDisplayName", - "()Ljava/lang/String;", - false); - mv.visitLdcInsn("GT_IRON_TO_STEEL"); - mv.visitMethodInsn( - INVOKESTATIC, - "thaumcraft/api/ThaumcraftApiHelper", - "isResearchComplete", - "(Ljava/lang/String;Ljava/lang/String;)Z", - false); - mv.visitJumpInsn(IFEQ, l6); - Label l39 = new Label(); - mv.visitLabel(l39); - mv.visitLineNumber(582, l39); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("steel"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l6); - mv.visitLineNumber(589, l6); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem."); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "startsWith", "(Ljava/lang/String;)Z", false); - Label l40 = new Label(); - mv.visitJumpInsn(IFEQ, l40); - Label l41 = new Label(); - mv.visitLabel(l41); - mv.visitLineNumber(590, l41); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32500"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l42 = new Label(); - mv.visitJumpInsn(IFEQ, l42); - Label l43 = new Label(); - mv.visitLabel(l43); - mv.visitLineNumber(591, l43); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestlead"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l44 = new Label(); - mv.visitLabel(l44); - mv.visitLineNumber(592, l44); - Label l45 = new Label(); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l42); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32501"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l46 = new Label(); - mv.visitJumpInsn(IFEQ, l46); - Label l47 = new Label(); - mv.visitLabel(l47); - mv.visitLineNumber(593, l47); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestsilver"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l48 = new Label(); - mv.visitLabel(l48); - mv.visitLineNumber(594, l48); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l46); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32503"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l49 = new Label(); - mv.visitJumpInsn(IFEQ, l49); - Label l50 = new Label(); - mv.visitLabel(l50); - mv.visitLineNumber(595, l50); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestiron"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l51 = new Label(); - mv.visitLabel(l51); - mv.visitLineNumber(596, l51); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l49); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32504"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l52 = new Label(); - mv.visitJumpInsn(IFEQ, l52); - Label l53 = new Label(); - mv.visitLabel(l53); - mv.visitLineNumber(597, l53); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestgold"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l54 = new Label(); - mv.visitLabel(l54); - mv.visitLineNumber(598, l54); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l52); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32530"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l55 = new Label(); - mv.visitJumpInsn(IFEQ, l55); - Label l56 = new Label(); - mv.visitLabel(l56); - mv.visitLineNumber(599, l56); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestcopper"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l57 = new Label(); - mv.visitLabel(l57); - mv.visitLineNumber(600, l57); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l55); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32540"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l58 = new Label(); - mv.visitJumpInsn(IFEQ, l58); - Label l59 = new Label(); - mv.visitLabel(l59); - mv.visitLineNumber(601, l59); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havesttin"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l60 = new Label(); - mv.visitLabel(l60); - mv.visitLineNumber(602, l60); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l58); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32510"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l61 = new Label(); - mv.visitJumpInsn(IFEQ, l61); - Label l62 = new Label(); - mv.visitLabel(l62); - mv.visitLineNumber(603, l62); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestoil"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l63 = new Label(); - mv.visitLabel(l63); - mv.visitLineNumber(604, l63); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l61); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.02.32511"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l64 = new Label(); - mv.visitJumpInsn(IFEQ, l64); - Label l65 = new Label(); - mv.visitLabel(l65); - mv.visitLineNumber(605, l65); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("havestemeralds"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l66 = new Label(); - mv.visitLabel(l66); - mv.visitLineNumber(606, l66); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l64); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.03.32082"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l67 = new Label(); - mv.visitJumpInsn(IFEQ, l67); - Label l68 = new Label(); - mv.visitLabel(l68); - mv.visitLineNumber(607, l68); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("energyflow"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l69 = new Label(); - mv.visitLabel(l69); - mv.visitLineNumber(608, l69); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l67); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32702"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l70 = new Label(); - mv.visitJumpInsn(IFEQ, l70); - Label l71 = new Label(); - mv.visitLabel(l71); - mv.visitLineNumber(609, l71); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("bettercircuits"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l72 = new Label(); - mv.visitLabel(l72); - mv.visitLineNumber(610, l72); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l70); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32707"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l73 = new Label(); - mv.visitJumpInsn(IFEQ, l73); - Label l74 = new Label(); - mv.visitLabel(l74); - mv.visitLineNumber(611, l74); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("datasaving"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l75 = new Label(); - mv.visitLabel(l75); - mv.visitLineNumber(612, l75); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l73); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32597"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l76 = new Label(); - mv.visitJumpInsn(IFEQ, l76); - Label l77 = new Label(); - mv.visitLabel(l77); - mv.visitLineNumber(613, l77); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("orbs"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l78 = new Label(); - mv.visitLabel(l78); - mv.visitLineNumber(614, l78); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l76); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32599"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l79 = new Label(); - mv.visitJumpInsn(IFEQ, l79); - Label l80 = new Label(); - mv.visitLabel(l80); - mv.visitLineNumber(615, l80); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("thatspower"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l81 = new Label(); - mv.visitLabel(l81); - mv.visitLineNumber(616, l81); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l79); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32598"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l82 = new Label(); - mv.visitJumpInsn(IFEQ, l82); - Label l83 = new Label(); - mv.visitLabel(l83); - mv.visitLineNumber(617, l83); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("luck"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l84 = new Label(); - mv.visitLabel(l84); - mv.visitLineNumber(618, l84); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l82); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32749"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l85 = new Label(); - mv.visitJumpInsn(IFEQ, l85); - Label l86 = new Label(); - mv.visitLabel(l86); - mv.visitLineNumber(619, l86); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("closeit"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l87 = new Label(); - mv.visitLabel(l87); - mv.visitLineNumber(620, l87); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l85); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32730"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l88 = new Label(); - mv.visitJumpInsn(IFEQ, l88); - Label l89 = new Label(); - mv.visitLabel(l89); - mv.visitLineNumber(621, l89); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("manipulation"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l90 = new Label(); - mv.visitLabel(l90); - mv.visitLineNumber(622, l90); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l88); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32729"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l91 = new Label(); - mv.visitJumpInsn(IFEQ, l91); - Label l92 = new Label(); - mv.visitLabel(l92); - mv.visitLineNumber(623, l92); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("filterregulate"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l93 = new Label(); - mv.visitLabel(l93); - mv.visitLineNumber(624, l93); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l91); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32605"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l94 = new Label(); - mv.visitJumpInsn(IFEQ, l94); - Label l95 = new Label(); - mv.visitLabel(l95); - mv.visitLineNumber(625, l95); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("whatnow"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l96 = new Label(); - mv.visitLabel(l96); - mv.visitLineNumber(626, l96); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l94); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32736"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l97 = new Label(); - mv.visitJumpInsn(IFEQ, l97); - Label l98 = new Label(); - mv.visitLabel(l98); - mv.visitLineNumber(627, l98); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("zpmage"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l99 = new Label(); - mv.visitLabel(l99); - mv.visitLineNumber(628, l99); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l97); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32737"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l100 = new Label(); - mv.visitJumpInsn(IFEQ, l100); - Label l101 = new Label(); - mv.visitLabel(l101); - mv.visitLineNumber(629, l101); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("uvage"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l102 = new Label(); - mv.visitLabel(l102); - mv.visitLineNumber(630, l102); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l100); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.03.32030"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l103 = new Label(); - mv.visitJumpInsn(IFEQ, l103); - Label l104 = new Label(); - mv.visitLabel(l104); - mv.visitLineNumber(631, l104); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("gtmonosilicon"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l105 = new Label(); - mv.visitLabel(l105); - mv.visitLineNumber(632, l105); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l103); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.03.32036"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l106 = new Label(); - mv.visitJumpInsn(IFEQ, l106); - Label l107 = new Label(); - mv.visitLabel(l107); - mv.visitLineNumber(633, l107); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("gtlogicwafer"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l108 = new Label(); - mv.visitLabel(l108); - mv.visitLineNumber(634, l108); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l106); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32701"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l109 = new Label(); - mv.visitJumpInsn(IFEQ, l109); - Label l110 = new Label(); - mv.visitLabel(l110); - mv.visitLineNumber(635, l110); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("gtlogiccircuit"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l111 = new Label(); - mv.visitLabel(l111); - mv.visitLineNumber(636, l111); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l109); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.03.32085"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l112 = new Label(); - mv.visitJumpInsn(IFEQ, l112); - Label l113 = new Label(); - mv.visitLabel(l113); - mv.visitLineNumber(637, l113); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("gtquantumprocessor"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l114 = new Label(); - mv.visitLabel(l114); - mv.visitLineNumber(638, l114); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l112); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.03.32089"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l115 = new Label(); - mv.visitJumpInsn(IFEQ, l115); - Label l116 = new Label(); - mv.visitLabel(l116); - mv.visitLineNumber(639, l116); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("gtcrystalprocessor"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l117 = new Label(); - mv.visitLabel(l117); - mv.visitLineNumber(640, l117); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l115); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.03.32092"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l118 = new Label(); - mv.visitJumpInsn(IFEQ, l118); - Label l119 = new Label(); - mv.visitLabel(l119); - mv.visitLineNumber(641, l119); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("gtwetware"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l120 = new Label(); - mv.visitLabel(l120); - mv.visitLineNumber(642, l120); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l118); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.03.32095"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l121 = new Label(); - mv.visitJumpInsn(IFEQ, l121); - Label l122 = new Label(); - mv.visitLabel(l122); - mv.visitLineNumber(643, l122); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("gtwetmain"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l123 = new Label(); - mv.visitLabel(l123); - mv.visitLineNumber(644, l123); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l121); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32736"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l124 = new Label(); - mv.visitJumpInsn(IFEQ, l124); - Label l125 = new Label(); - mv.visitLabel(l125); - mv.visitLineNumber(645, l125); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("zpmage"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l126 = new Label(); - mv.visitLabel(l126); - mv.visitLineNumber(646, l126); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l124); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.metaitem.01.32737"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - mv.visitJumpInsn(IFEQ, l45); - Label l127 = new Label(); - mv.visitLabel(l127); - mv.visitLineNumber(647, l127); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("uvage"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l128 = new Label(); - mv.visitLabel(l128); - mv.visitLineNumber(649, l128); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l40); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("gt.Thoriumcell"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - Label l129 = new Label(); - mv.visitJumpInsn(IFEQ, l129); - Label l130 = new Label(); - mv.visitLabel(l130); - mv.visitLineNumber(650, l130); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("newfuel"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l131 = new Label(); - mv.visitLabel(l131); - mv.visitLineNumber(651, l131); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l129); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - mv.visitFieldInsn(GETSTATIC, "ic2/core/Ic2Items", "quantumBodyarmor", "Lnet/minecraft/item/ItemStack;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - Label l132 = new Label(); - mv.visitJumpInsn(IF_ACMPEQ, l132); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - mv.visitFieldInsn(GETSTATIC, "ic2/core/Ic2Items", "quantumBoots", "Lnet/minecraft/item/ItemStack;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - mv.visitJumpInsn(IF_ACMPEQ, l132); - Label l133 = new Label(); - mv.visitLabel(l133); - mv.visitLineNumber(652, l133); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - mv.visitFieldInsn(GETSTATIC, "ic2/core/Ic2Items", "quantumHelmet", "Lnet/minecraft/item/ItemStack;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - mv.visitJumpInsn(IF_ACMPEQ, l132); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - mv.visitFieldInsn(GETSTATIC, "ic2/core/Ic2Items", "quantumLeggings", "Lnet/minecraft/item/ItemStack;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getItem", "()Lnet/minecraft/item/Item;", false); - Label l134 = new Label(); - mv.visitJumpInsn(IF_ACMPNE, l134); - mv.visitLabel(l132); - mv.visitLineNumber(653, l132); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("buildQArmor"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - Label l135 = new Label(); - mv.visitLabel(l135); - mv.visitLineNumber(654, l135); - mv.visitJumpInsn(GOTO, l45); - mv.visitLabel(l134); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false); - mv.visitLdcInsn("ic2.itemPartCircuitAdv"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); - mv.visitJumpInsn(IFEQ, l45); - Label l136 = new Label(); - mv.visitLabel(l136); - mv.visitLineNumber(655, l136); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn("stepforward"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "issueAchievement", - "(Lnet/minecraft/entity/player/EntityPlayer;Ljava/lang/String;)V", - false); - mv.visitLabel(l45); - mv.visitLineNumber(657, l45); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(RETURN); - Label l137 = new Label(); - mv.visitLabel(l137); - mv.visitLocalVariable("this", "Lgregtech/loaders/misc/GT_Achievements;", null, l0, l137, 0); - mv.visitLocalVariable( - "event", "Lnet/minecraftforge/event/entity/player/EntityItemPickupEvent;", null, l0, l137, 1); - mv.visitLocalVariable("player", "Lnet/minecraft/entity/player/EntityPlayer;", null, l1, l137, 2); - mv.visitLocalVariable("stack", "Lnet/minecraft/item/ItemStack;", null, l2, l137, 3); - mv.visitLocalVariable("data", "Lgregtech/api/objects/ItemData;", null, l5, l137, 4); - mv.visitLocalVariable("data_getAllMaterialStacks_sS", "I", null, l16, l25, 5); - mv.visitLocalVariable("i", "I", null, l17, l25, 6); - mv.visitMaxs(4, 7); - mv.visitEnd(); - - didInject = true; - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public class MethodAdaptor extends ClassVisitor { - - public MethodAdaptor(ClassVisitor cv) { - super(ASM5, cv); - this.cv = cv; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - if (name.equals("registerAssAchievement") || name.equals("onItemPickup")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Found method " + name + ", removing."); - methodVisitor = null; - if (name.equals("registerAssAchievement")) { - mDidRemoveAssLineRecipeAdder = true; - } - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Achievements_CrashFix.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Achievements_CrashFix.java deleted file mode 100644 index e373c319cf..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Achievements_CrashFix.java +++ /dev/null @@ -1,244 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_Achievements_CrashFix { - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - private final boolean mObfuscated; - private static boolean mDidRemoveAssLineRecipeAdder = false; - - public ClassTransformer_GT_Achievements_CrashFix(byte[] basicClass, boolean obfuscated) { - - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - mObfuscated = obfuscated; - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - - aTempReader.accept(new MethodAdaptor(aTempWriter), 0); - - if (mDidRemoveAssLineRecipeAdder) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Patching GT .09"); - injectMethod(aTempWriter); - } else { - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Patch not required, skipping."); - } - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Valid? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(ClassWriter cw) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Achievements Patch", - Level.INFO, - "Injecting " + "registerAssAchievement" + ". Obfuscated? " + mObfuscated); - - /** - * Inject new, safer code - */ - mv = cw.visitMethod( - ACC_PUBLIC, - "registerAssAchievement", - "(Lgregtech/api/util/GT_Recipe;)Lnet/minecraft/stats/Achievement;", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(293, l0); - mv.visitVarInsn(ALOAD, 1); - Label l1 = new Label(); - mv.visitJumpInsn(IFNONNULL, l1); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(294, l2); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitLdcInsn( - "GTPP_MOD: Someone tried to register an achievement for an invalid recipe. Please report this to Alkalus."); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLineNumber(295, l3); - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - mv.visitLabel(l1); - mv.visitLineNumber(297, l1); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 1); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn( - INVOKEVIRTUAL, "gregtech/api/util/GT_Recipe", "getOutput", "(I)Lnet/minecraft/item/ItemStack;", false); - Label l4 = new Label(); - mv.visitJumpInsn(IFNONNULL, l4); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(298, l5); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitLdcInsn( - "GTPP_MOD: Someone tried to register an achievement for a recipe with null output. Please report this to Alkalus."); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - Label l6 = new Label(); - mv.visitLabel(l6); - mv.visitLineNumber(299, l6); - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - mv.visitLabel(l4); - mv.visitLineNumber(301, l4); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 1); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn( - INVOKEVIRTUAL, "gregtech/api/util/GT_Recipe", "getOutput", "(I)Lnet/minecraft/item/ItemStack;", false); - mv.visitVarInsn(ASTORE, 3); - Label l7 = new Label(); - mv.visitLabel(l7); - mv.visitLineNumber(302, l7); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/ItemUtils", - "getUnlocalizedItemName", - "(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;", - false); - mv.visitVarInsn(ASTORE, 2); - Label l8 = new Label(); - mv.visitLabel(l8); - mv.visitLineNumber(304, l8); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn( - GETFIELD, - "gregtech/loaders/misc/GT_Achievements", - "achievementList", - "Ljava/util/concurrent/ConcurrentHashMap;"); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "java/util/concurrent/ConcurrentHashMap", - "get", - "(Ljava/lang/Object;)Ljava/lang/Object;", - false); - Label l9 = new Label(); - mv.visitJumpInsn(IFNONNULL, l9); - Label l10 = new Label(); - mv.visitLabel(l10); - mv.visitLineNumber(305, l10); - mv.visitFieldInsn(GETSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - mv.visitInsn(ICONST_1); - mv.visitInsn(IADD); - mv.visitFieldInsn(PUTSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - Label l11 = new Label(); - mv.visitLabel(l11); - mv.visitLineNumber(306, l11); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 2); - mv.visitIntInsn(BIPUSH, 11); - mv.visitFieldInsn(GETSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - mv.visitInsn(ICONST_5); - mv.visitInsn(IREM); - mv.visitInsn(IADD); - mv.visitInsn(INEG); - mv.visitFieldInsn(GETSTATIC, "gregtech/loaders/misc/GT_Achievements", "assReg", "I"); - mv.visitInsn(ICONST_5); - mv.visitInsn(IDIV); - mv.visitIntInsn(BIPUSH, 8); - mv.visitInsn(ISUB); - mv.visitVarInsn(ALOAD, 1); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn( - INVOKEVIRTUAL, "gregtech/api/util/GT_Recipe", "getOutput", "(I)Lnet/minecraft/item/ItemStack;", false); - mv.visitLdcInsn("NO_REQUIREMENT"); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/loaders/misc/GT_Achievements", - "registerAchievement", - "(Ljava/lang/String;IILnet/minecraft/item/ItemStack;Ljava/lang/String;Z)Lnet/minecraft/stats/Achievement;", - false); - mv.visitVarInsn(ASTORE, 4); - Label l12 = new Label(); - mv.visitLabel(l12); - mv.visitLineNumber(307, l12); - Label l13 = new Label(); - mv.visitJumpInsn(GOTO, l13); - mv.visitLabel(l9); - mv.visitLineNumber(309, l9); - mv.visitFrame(F_APPEND, 2, new Object[] {"java/lang/String", "net/minecraft/item/ItemStack"}, 0, null); - mv.visitInsn(ACONST_NULL); - mv.visitVarInsn(ASTORE, 4); - mv.visitLabel(l13); - mv.visitLineNumber(311, l13); - mv.visitFrame(F_APPEND, 1, new Object[] {"net/minecraft/stats/Achievement"}, 0, null); - mv.visitVarInsn(ALOAD, 4); - mv.visitInsn(ARETURN); - Label l14 = new Label(); - mv.visitLabel(l14); - mv.visitLocalVariable("this", "Lgregtech/loaders/misc/GT_Achievements;", null, l0, l14, 0); - mv.visitLocalVariable("recipe", "Lgregtech/api/util/GT_Recipe;", null, l0, l14, 1); - mv.visitLocalVariable("aSafeUnlocalName", "Ljava/lang/String;", null, l8, l14, 2); - mv.visitLocalVariable("aStack", "Lnet/minecraft/item/ItemStack;", null, l7, l14, 3); - mv.visitLocalVariable("aYouDidSomethingInGT", "Lnet/minecraft/stats/Achievement;", null, l12, l9, 4); - mv.visitLocalVariable("aYouDidSomethingInGT", "Lnet/minecraft/stats/Achievement;", null, l13, l14, 4); - mv.visitMaxs(7, 5); - mv.visitEnd(); - - didInject = true; - FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public class MethodAdaptor extends ClassVisitor { - - public MethodAdaptor(ClassVisitor cv) { - super(ASM5, cv); - this.cv = cv; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - if (name.equals("registerAssAchievement")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Found method " + name + ", removing."); - methodVisitor = null; - mDidRemoveAssLineRecipeAdder = true; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BaseMetaTileEntity.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BaseMetaTileEntity.java deleted file mode 100644 index 61c7394b4a..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BaseMetaTileEntity.java +++ /dev/null @@ -1,179 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_BaseMetaTileEntity { - - // The qualified name of the class we plan to transform. - // gregtech/common/blocks/GT_Block_Machines - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - public ClassTransformer_GT_BaseMetaTileEntity(byte[] basicClass) { - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech setMetaTileEntity Patch", - Level.INFO, - "Attempting to make setMetaTileEntity(IMetaTileEntity) safer."); - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new localClassVisitor(aTempWriter), 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Valid patch? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Attempting Method Injection."); - injectMethod("setMetaTileEntity"); - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log("[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Injecting " + aMethodName + "."); - if (aMethodName.equals("setMetaTileEntity")) { - - mv = getWriter() - .visitMethod( - ACC_PUBLIC, - "setMetaTileEntity", - "(Lgregtech/api/interfaces/metatileentity/IMetaTileEntity;)V", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - Label l1 = new Label(); - Label l2 = new Label(); - mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable"); - mv.visitLabel(l0); - mv.visitLineNumber(1568, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/metatileentity/MetaTileEntity"); - mv.visitFieldInsn( - PUTFIELD, - "gregtech/api/metatileentity/BaseMetaTileEntity", - "mMetaTileEntity", - "Lgregtech/api/metatileentity/MetaTileEntity;"); - mv.visitLabel(l1); - mv.visitLineNumber(1569, l1); - Label l3 = new Label(); - mv.visitJumpInsn(GOTO, l3); - mv.visitLabel(l2); - mv.visitLineNumber(1570, l2); - mv.visitFrame(F_SAME1, 0, null, 1, new Object[] {"java/lang/Throwable"}); - mv.visitVarInsn(ASTORE, 2); - Label l4 = new Label(); - mv.visitLabel(l4); - mv.visitLineNumber(1571, l4); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitLdcInsn("[BMTE] Bad Tile Entity set in world, your game would have crashed if not for me!"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(1572, l5); - mv.visitVarInsn(ALOAD, 1); - Label l6 = new Label(); - mv.visitJumpInsn(IFNULL, l6); - Label l7 = new Label(); - mv.visitLabel(l7); - mv.visitLineNumber(1573, l7); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitTypeInsn(NEW, "java/lang/StringBuilder"); - mv.visitInsn(DUP); - mv.visitLdcInsn("Tile was of type: "); - mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V", false); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn( - INVOKEINTERFACE, - "gregtech/api/interfaces/metatileentity/IMetaTileEntity", - "getInventoryName", - "()Ljava/lang/String;", - true); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "java/lang/StringBuilder", - "append", - "(Ljava/lang/String;)Ljava/lang/StringBuilder;", - false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - mv.visitLabel(l6); - mv.visitLineNumber(1574, l6); - mv.visitFrame(F_APPEND, 1, new Object[] {"java/lang/Throwable"}, 0, null); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Throwable", "printStackTrace", "()V", false); - mv.visitLabel(l3); - mv.visitLineNumber(1576, l3); - mv.visitFrame(F_CHOP, 1, null, 0, null); - mv.visitInsn(RETURN); - Label l8 = new Label(); - mv.visitLabel(l8); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/BaseMetaTileEntity;", null, l0, l8, 0); - mv.visitLocalVariable( - "aMetaTileEntity", "Lgregtech/api/interfaces/metatileentity/IMetaTileEntity;", null, l0, l8, 1); - mv.visitLocalVariable("t", "Ljava/lang/Throwable;", null, l4, l3, 2); - mv.visitMaxs(4, 3); - mv.visitEnd(); - - didInject = true; - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech setMetaTileEntity Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public final class localClassVisitor extends ClassVisitor { - - public localClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - if (name.equals("setMetaTileEntity")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech setMetaTileEntity Patch", - Level.INFO, - "Found method " + name + ", removing."); - methodVisitor = null; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java deleted file mode 100644 index 7e0306853d..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java +++ /dev/null @@ -1,312 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.ARETURN; -import static org.objectweb.asm.Opcodes.ASM5; -import static org.objectweb.asm.Opcodes.GETFIELD; -import static org.objectweb.asm.Opcodes.ILOAD; -import static org.objectweb.asm.Opcodes.INVOKESTATIC; -import static org.objectweb.asm.Opcodes.IRETURN; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.SubTag; -import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_BlockMachines_MetaPipeEntity { - - // The qualified name of the class we plan to transform. - // gregtech/common/blocks/GT_Block_Machines - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - /** - * Utility Functions - */ - public static String getHarvestTool(int aMeta) { - // FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Attempting to call - // getHarvestTool. Meta: "+aMeta); - if (aMeta >= 8 && aMeta <= 11) { - return "cutter"; - } - return "wrench"; - } - - /* - * Used to patch the method in Fluid pipes, Frame Boxes and Item Pipes - */ - /** - * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. - * <p/> - * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantle - * 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle - * <p/> - * 2 = BaseMetaTileEntity, Wrench lvl 2 to dismantle - * 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle - * <p/> - * 4 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle - * 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle - * <p/> - * 6 = BaseMetaPipeEntity, Wrench lvl 2 to dismantle - * 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle - * <p/> - * 8 = BaseMetaPipeEntity, Cutter lvl 0 to dismantle - * 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle - * <p/> - * 10 = BaseMetaPipeEntity, Cutter lvl 2 to dismantle - * 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle - * <p/> - * == Reserved For Alkalus (Was previously used to allow axes on wooden blocks, but that's fucking stupid.) - * <p/> - * 12 = BaseCustomPower_MTE, Wrench lvl 0 to dismantle - * 13 = BaseCustomTileEntity, Wrench lvl 1 to dismantle - * <p/> - * 14 = BaseCustomTileEntity, Wrench lvl 2 to dismantle - * 15 = BaseCustomTileEntity, Wrench lvl 3 to dismantle - */ - public static byte getTileEntityBaseType(Materials mMaterial) { - byte mMetaID; - // Modified code that should never return 12-15 for Wooden items. - // mMetaID = (byte) (mMaterial == null ? 4 : (byte) (4) + Math.max(0, Math.min(3, mMaterial.mToolQuality))); - // Original Code for debug purposes - mMetaID = mMaterial == null - ? 4 - : (byte) ((mMaterial.contains(SubTag.WOOD) ? 4 : 4) + Math.max(0, Math.min(3, mMaterial.mToolQuality))); - // FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Attempting to call - // getTileEntityBaseType. Using Meta: "+mMetaID); - return mMetaID; - } - - /** - * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. - * <p/> - * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantle - * 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle - * <p/> - * 2 = BaseMetaTileEntity, Wrench lvl 2 to dismantle - * 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle - * <p/> - * 4 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle - * 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle - * <p/> - * 6 = BaseMetaPipeEntity, Wrench lvl 2 to dismantle - * 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle - * <p/> - * 8 = BaseMetaPipeEntity, Cutter lvl 0 to dismantle - * 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle - * <p/> - * 10 = BaseMetaPipeEntity, Cutter lvl 2 to dismantle - * 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle - * <p/> - * == Reserved For Alkalus (Was previously used to allow axes on wooden blocks, but that's fucking stupid.) - * <p/> - * 12 = BaseCustomPower_MTE, Wrench lvl 2 to dismantle - * 13 = BaseCustomTileEntity, Wrench lvl 2 to dismantle - * <p/> - * 14 = BaseCustomTileEntity, Wrench lvl 3 to dismantle - * 15 = BaseCustomTileEntity, Wrench lvl 3 to dismantle - */ - public static TileEntity createTileEntity(World aWorld, int aMeta) { - // Logger.INFO("Creating Tile Entity with Meta of "+aMeta); - if (aMeta < 4) { - return GregTech_API.constructBaseMetaTileEntity(); - } else if (aMeta < 12) { - return new BaseMetaPipeEntity(); - } else { - // Because Wooden pipes/frames may exist in world, we try cast to the GT++ tile first, if tht fails, we cast - // a pipe.. - try { - return Meta_GT_Proxy.constructCustomGregtechMetaTileEntityByMeta(aMeta); - } catch (Throwable c) { - // Returns a pipe entity, once this returns, it should correct itself and no longer error in future. - return new BaseMetaPipeEntity(); - } - } - } - - public static TileEntity createTileEntity_Original(World aWorld, int aMeta) { - // Logger.INFO("Creating Tile Entity with Meta of "+aMeta); - if (aMeta < 4) { - return GregTech_API.constructBaseMetaTileEntity(); - } else { - return new BaseMetaPipeEntity(); - } - } - - int mMode; - - public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, int aMode) { - mMode = aMode; - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech getTileEntityBaseType Patch", - Level.INFO, - "Attempting to patch in mode " + aMode + "."); - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new localClassVisitor(aTempWriter, mMode), 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Valid patch? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Attempting Method Injection."); - if (aMode == 0) { - injectMethod("getHarvestTool"); - injectMethod("createTileEntity"); - } else { - injectMethod("getTileEntityBaseType"); - } - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Injecting " + aMethodName + "."); - if (aMethodName.equals("getHarvestTool")) { - mv = getWriter().visitMethod(ACC_PUBLIC, "getHarvestTool", "(I)Ljava/lang/String;", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(63, l0); - mv.visitVarInsn(ILOAD, 1); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity", - "getHarvestTool", - "(I)Ljava/lang/String;", - false); - mv.visitInsn(ARETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "Lgregtech/common/blocks/GT_Block_Machines;", null, l0, l1, 0); - mv.visitLocalVariable("aMeta", "I", null, l0, l1, 1); - mv.visitMaxs(1, 2); - mv.visitEnd(); - didInject = true; - } else if (aMethodName.equals("createTileEntity")) { - mv = getWriter() - .visitMethod( - ACC_PUBLIC, - "createTileEntity", - "(Lnet/minecraft/world/World;I)Lnet/minecraft/tileentity/TileEntity;", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(442, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity", - "createTileEntity", - "(Lnet/minecraft/world/World;I)Lnet/minecraft/tileentity/TileEntity;", - false); - mv.visitInsn(ARETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "Lgregtech/common/blocks/GT_Block_Machines;", null, l0, l1, 0); - mv.visitLocalVariable("aWorld", "Lnet/minecraft/world/World;", null, l0, l1, 1); - mv.visitLocalVariable("aMeta", "I", null, l0, l1, 2); - mv.visitMaxs(2, 3); - mv.visitEnd(); - didInject = true; - - } else if (aMethodName.equals("getTileEntityBaseType")) { - - String aClassName = mMode == 1 - ? "gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item" - : mMode == 2 - ? "gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame" - : "gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid"; - mv = getWriter().visitMethod(ACC_PUBLIC, "getTileEntityBaseType", "()B", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(37, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "" + aClassName + "", "mMaterial", "Lgregtech/api/enums/Materials;"); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity", - "getTileEntityBaseType", - "(Lgregtech/api/enums/Materials;)B", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "L" + aClassName + ";", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public final class localClassVisitor extends ClassVisitor { - - private final int mMode; - - public localClassVisitor(ClassVisitor cv, int aMode) { - super(ASM5, cv); - mMode = aMode; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - if ((mMode == 0 && (name.equals("createTileEntity") || name.equals("getHarvestTool"))) - || (mMode > 0 && name.equals("getTileEntityBaseType"))) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech getTileEntityBaseType Patch", - Level.INFO, - "Found method " + name + ", removing."); - methodVisitor = null; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_NBT.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_NBT.java deleted file mode 100644 index 744af6674a..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_NBT.java +++ /dev/null @@ -1,218 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.preloader.DevHelper; -import gtPlusPlus.preloader.asm.AsmConfig; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_BlockMachines_NBT { - - // The qualified name of the class we plan to transform. - private static final String className = "gregtech.common.blocks.GT_Block_Machines"; - // gregtech/common/blocks/GT_Block_Machines - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - String aEntityPlayer; - String aEntityPlayerMP; - String aWorld; - - public static boolean isNbtPersistencyPatchAlreadyApplied = false; - - public ClassTransformer_GT_BlockMachines_NBT(byte[] basicClass, boolean obfuscated) { - - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Attempting to patch " + className + "."); - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new localClassVisitor(aTempWriter), 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Valid patch? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - - CORE.NBT_PERSISTENCY_PATCH_APPLIED = isNbtPersistencyPatchAlreadyApplied; - - if (reader != null && writer != null && !isNbtPersistencyPatchAlreadyApplied && AsmConfig.enableGtNbtFix) { - aEntityPlayer = obfuscated - ? DevHelper.getObfuscated("net/minecraft/entity/player/EntityPlayer") - : "net/minecraft/entity/player/EntityPlayer"; - aEntityPlayerMP = obfuscated - ? DevHelper.getObfuscated("net/minecraft/entity/player/EntityPlayerMP") - : "net/minecraft/entity/player/EntityPlayerMP"; - aWorld = obfuscated ? DevHelper.getObfuscated("net/minecraft/world/World") : "net/minecraft/world/World"; - FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Attempting Method Injection."); - if (injectMethod("removedByPlayer") && injectMethod("harvestBlock")) { - CORE.NBT_PERSISTENCY_PATCH_APPLIED = true; - } - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech NBT Persistency Patch", - Level.INFO, - "Injecting " + aMethodName + " into " + className + "."); - if (aMethodName.equals("removedByPlayer")) { - - mv = getWriter() - .visitMethod( - ACC_PUBLIC, - "removedByPlayer", - "(L" + aWorld + ";L" + aEntityPlayer + ";IIIZ)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(535, l0); - mv.visitVarInsn(ILOAD, 6); - Label l1 = new Label(); - mv.visitJumpInsn(IFEQ, l1); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(536, l2); - mv.visitInsn(ICONST_1); - mv.visitInsn(IRETURN); - mv.visitLabel(l1); - mv.visitLineNumber(538, l1); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ILOAD, 3); - mv.visitVarInsn(ILOAD, 4); - mv.visitVarInsn(ILOAD, 5); - mv.visitInsn(ICONST_0); - mv.visitMethodInsn( - INVOKESPECIAL, - "gregtech/api/items/GT_Generic_Block", - "removedByPlayer", - "(L" + aWorld + ";L" + aEntityPlayer + ";IIIZ)Z", - false); - mv.visitInsn(IRETURN); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/common/blocks/GT_Block_Machines;", null, l0, l3, 0); - mv.visitLocalVariable("aWorld", "L" + aWorld + ";", null, l0, l3, 1); - mv.visitLocalVariable("aPlayer", "L" + aEntityPlayer + ";", null, l0, l3, 2); - mv.visitLocalVariable("aX", "I", null, l0, l3, 3); - mv.visitLocalVariable("aY", "I", null, l0, l3, 4); - mv.visitLocalVariable("aZ", "I", null, l0, l3, 5); - mv.visitLocalVariable("aWillHarvest", "Z", null, l0, l3, 6); - mv.visitMaxs(7, 7); - mv.visitEnd(); - didInject = true; - - } else if (aMethodName.equals("harvestBlock")) { - - mv = getWriter() - .visitMethod( - ACC_PUBLIC, "harvestBlock", "(L" + aWorld + ";L" + aEntityPlayer + ";IIII)V", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(544, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ILOAD, 3); - mv.visitVarInsn(ILOAD, 4); - mv.visitVarInsn(ILOAD, 5); - mv.visitVarInsn(ILOAD, 6); - mv.visitMethodInsn( - INVOKESPECIAL, - "gregtech/api/items/GT_Generic_Block", - "harvestBlock", - "(L" + aWorld + ";L" + aEntityPlayer + ";IIII)V", - false); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(545, l1); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ILOAD, 3); - mv.visitVarInsn(ILOAD, 4); - mv.visitVarInsn(ILOAD, 5); - mv.visitMethodInsn(INVOKEVIRTUAL, "" + aWorld + "", "setBlockToAir", "(III)Z", false); - mv.visitInsn(POP); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(546, l2); - mv.visitInsn(RETURN); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/common/blocks/GT_Block_Machines;", null, l0, l3, 0); - mv.visitLocalVariable("aWorld", "L" + aWorld + ";", null, l0, l3, 1); - mv.visitLocalVariable("aPlayer", "L" + aEntityPlayer + ";", null, l0, l3, 2); - mv.visitLocalVariable("aX", "I", null, l0, l3, 3); - mv.visitLocalVariable("aY", "I", null, l0, l3, 4); - mv.visitLocalVariable("aZ", "I", null, l0, l3, 5); - mv.visitLocalVariable("aMeta", "I", null, l0, l3, 6); - mv.visitMaxs(7, 7); - mv.visitEnd(); - didInject = true; - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public static final class localClassVisitor extends ClassVisitor { - - public localClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - if (name.equals("removedByPlayer")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech NBT Persistency Patch", - Level.INFO, - "Found method " + name + ", skipping patch."); - isNbtPersistencyPatchAlreadyApplied = true; - } - if (name.equals("harvestBlock")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech NBT Persistency Patch", - Level.INFO, - "Found method " + name + ", skipping patch."); - isNbtPersistencyPatchAlreadyApplied = true; - } - MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java deleted file mode 100644 index 7fb2347d1e..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java +++ /dev/null @@ -1,201 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import java.util.ArrayList; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_CharcoalPit { - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - public static boolean isWoodLog(Block log) { - return isWoodLog(log, Short.MAX_VALUE); - } - - public static boolean isWoodLog(Block log, int meta) { - ItemStack aLogStack = ItemUtils.getSimpleStack(log, meta, 1); - ArrayList<ItemStack> aData = OrePrefixes.log.mPrefixedItems; - for (ItemStack aStack : aData) { - if (GT_Utility.areStacksEqual(aStack, aLogStack)) { - return true; - } - } - aData.clear(); - aData = OreDictionary.getOres("logWood"); - for (ItemStack aStack : aData) { - if (GT_Utility.areStacksEqual(aStack, aLogStack)) { - return true; - } - } - return false; - } - - public ClassTransformer_GT_CharcoalPit(byte[] basicClass, boolean obfuscated) { - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - boolean aBadTime = false; - if (ReflectionUtils.doesClassExist("aji")) { - obfuscated = true; - } else { - if (ReflectionUtils.doesClassExist("net.minecraft.block.Block")) { - obfuscated = false; - } else { - // Bad... Like.. very bad.. - FMLRelaunchLog.log( - "[GT++ ASM] GT Charcoal Pit Fix", - Level.INFO, - "Unable to find Block.class/aji.class, this is BAD. Not Patching."); - } - } - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - if (!aBadTime) { - aTempReader.accept(new CustomClassVisitor(aTempWriter), 0); - injectMethod("isWoodLog", obfuscated, aTempWriter); - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - } else { - isValid = false; - } - FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Valid? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName, boolean obfuscated, ClassWriter cw) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Injecting " + aMethodName + "."); - - String aBlockClassName = "net/minecraft/block/Block"; - if (obfuscated) { - aBlockClassName = "aji"; - } - if (aMethodName.equals("isWoodLog")) { - - // Inject original Method with only block arg. - mv = cw.visitMethod(ACC_PUBLIC, "isWoodLog", "(L" + aBlockClassName + ";)Z", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(197, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit", - "isWoodLog", - "(L" + aBlockClassName + ";)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable( - "this", - "Lgregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit;", - null, - l0, - l1, - 0); - mv.visitLocalVariable("log", "L" + aBlockClassName + ";", null, l0, l1, 1); - mv.visitMaxs(1, 2); - mv.visitEnd(); - - // Inject better Method with block & meta arg. - mv = cw.visitMethod(ACC_PUBLIC, "isWoodLog", "(L" + aBlockClassName + ";I)Z", null, null); - mv.visitCode(); - Label label0 = new Label(); - mv.visitLabel(label0); - mv.visitLineNumber(201, label0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit", - "isWoodLog", - "(L" + aBlockClassName + ";I)Z", - false); - mv.visitInsn(IRETURN); - Label label1 = new Label(); - mv.visitLabel(label1); - mv.visitLocalVariable( - "this", - "Lgregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit;", - null, - label0, - label1, - 0); - mv.visitLocalVariable("log", "L" + aBlockClassName + ";", null, label0, label1, 1); - mv.visitLocalVariable("meta", "I", null, label0, label1, 2); - mv.visitMaxs(2, 3); - mv.visitEnd(); - - didInject = true; - } - FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Method injection complete."); - return didInject; - } - - public class CustomClassVisitor extends ClassVisitor { - - public CustomClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - this.cv = cv; - } - - private final String[] aMethodsToStrip = new String[] {"isWoodLog"}; - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - boolean found = false; - - for (String s : aMethodsToStrip) { - if (name.equals(s)) { - found = true; - break; - } - } - if (!found) { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } else { - methodVisitor = null; - } - if (found) { - FMLRelaunchLog.log( - "[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Found method " + name + ", removing."); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java deleted file mode 100644 index 69dfc61e9a..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java +++ /dev/null @@ -1,417 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.ASM5; -import static org.objectweb.asm.Opcodes.INVOKESPECIAL; -import static org.objectweb.asm.Opcodes.INVOKESTATIC; -import static org.objectweb.asm.Opcodes.RETURN; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import com.google.common.reflect.ClassPath; -import com.google.common.reflect.ClassPath.ClassInfo; -import cpw.mods.fml.common.gameevent.TickEvent.Phase; -import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_PlayedSound; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import gtPlusPlus.xmod.gregtech.loaders.misc.AssLineAchievements; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; -import java.util.jar.JarEntry; -import java.util.jar.JarInputStream; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatFileWriter; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_Client { - - private final boolean valid; - private final ClassReader read; - private final ClassWriter write; - private boolean mModern = true; - private boolean mObfuscated = true; - private byte[] mTooledClass; - - public ClassTransformer_GT_Client(byte[] basicClass, boolean obfuscated) { - - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - mObfuscated = obfuscated; - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - - /** - * Let's just read the GT archive for some info - */ - // mModern = findAssemblyLineClass(); - // FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Found Assembly Line? - // "+mModern+"."); - FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Fixing Issues in vanilla GT."); - if (mModern) { - aTempReader.accept(new MethodAdaptor2(aTempWriter), 0); - // FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patching Client handling of - // Assembly Line recipe visibility for GT 5.09"); - // injectMethod(aTempWriter, "onPlayerTickEventClient"); - injectMethod(aTempWriter, "onPostLoad"); - if (aTempReader != null && aTempWriter != null) { - valid = true; - mTooledClass = aTempWriter.toByteArray(); - } else { - valid = false; - } - } else { - mTooledClass = basicClass; - valid = true; - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Valid? " + valid + "."); - read = aTempReader; - write = aTempWriter; - } - - public boolean isValidTransformer() { - return valid; - } - - public ClassReader getReader() { - return read; - } - - public ClassWriter getWriter() { - return write; - } - - public boolean findAssemblyLineClass() { - ClassLoader cl = getClass().getClassLoader(); - try { - Set<ClassPath.ClassInfo> classesInPackage = ClassPath.from(cl).getTopLevelClassesRecursive("gregtech"); - if (classesInPackage != null && classesInPackage.size() > 0) { - for (ClassInfo x : classesInPackage) { - if (x.getResourceName().contains("GT_MetaTileEntity_AssemblyLine")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Client Proxy Patch", - Level.INFO, - "Patchable class | " + x.getResourceName()); - return true; - } - } - } - } catch (IOException e) { - } - - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Client Proxy Patch", - Level.INFO, - "Failed to find Gregtech classes using prefered method, using backup."); - - cl = ClassLoader.getSystemClassLoader(); - ImmutableMap<File, ClassLoader> g = getClassPathEntries(cl); - File aGregtech = null; - if (g.size() > 0) { - for (int i = 0; i < g.size(); i++) { - String aName; - try { - File aF = g.keySet().asList().get(i); - aName = aF.getName(); - if (aName != null && aName.length() > 0) { - if (aName.toLowerCase().contains("gregtech")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patchable class | " + aName); - aGregtech = aF; - } - } - } catch (Throwable t) { - } - } - } - - if (aGregtech != null) { - File file = aGregtech; - FileInputStream fis; - JarInputStream jis; - try { - fis = new FileInputStream(file); - jis = new JarInputStream(fis); - System.out.println(jis.markSupported()); - JarEntry je; - while ((je = jis.getNextJarEntry()) != null) { - if (je.getName().contains("GT_MetaTileEntity_AssemblyLine")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Client Proxy Patch", - Level.INFO, - "Patchable class | " + je.getName()); - jis.close(); - return true; - } - } - if (jis != null) { - jis.close(); - } - return true; - } catch (IOException e1) { - } - } - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Client Proxy Patch", - Level.INFO, - "Failed to find Gregtech classes using backup method, probably using GT 5.08"); - - return false; - } - - static ImmutableMap<File, ClassLoader> getClassPathEntries(ClassLoader classloader) { - LinkedHashMap<File, ClassLoader> entries = Maps.newLinkedHashMap(); - // Search parent first, since it's the order ClassLoader#loadClass() uses. - ClassLoader parent = classloader.getParent(); - if (parent != null) { - entries.putAll(getClassPathEntries(parent)); - } - if (classloader instanceof URLClassLoader) { - URLClassLoader urlClassLoader = (URLClassLoader) classloader; - for (URL entry : urlClassLoader.getURLs()) { - if (entry.getProtocol().equals("file")) { - File file = new File(entry.getFile()); - if (!entries.containsKey(file)) { - entries.put(file, classloader); - } - } - } - } - return ImmutableMap.copyOf(entries); - } - - public boolean injectMethod(ClassWriter cw, String string) { - MethodVisitor mv; - boolean didInject = false; - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Client Proxy Patch", - Level.INFO, - "Injecting " + string + ". Obfuscated? " + mObfuscated); - - if (string.equals("onPlayerTickEventClient")) { - /** - * Inject new, safer code - */ - AnnotationVisitor av0; - /** - * Static invocation of custom handler instead - */ - mv = cw.visitMethod( - ACC_PUBLIC, - "onPlayerTickEventClient", - "(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", - null, - null); - av0 = mv.visitAnnotation("Lcpw/mods/fml/common/eventhandler/SubscribeEvent;", true); - av0.visitEnd(); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(371, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client", - "onPlayerTickEventClient", - "(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", - false); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(372, l1); - mv.visitInsn(RETURN); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/common/GT_Client;", null, l0, l2, 0); - mv.visitLocalVariable( - "aEvent", "Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;", null, l0, l2, 1); - mv.visitMaxs(1, 2); - mv.visitEnd(); - didInject = true; - } else if (string.equals("onPostLoad")) { - mv = cw.visitMethod(ACC_PUBLIC, "onPostLoad", "()V", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(315, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/common/GT_Proxy", "onPostLoad", "()V", false); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(316, l1); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client", - "onPostLoad", - "()V", - false); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(317, l2); - mv.visitInsn(RETURN); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/common/GT_Client;", null, l0, l3, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - - FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public class MethodAdaptor2 extends ClassVisitor { - - public MethodAdaptor2(ClassVisitor cv) { - super(ASM5, cv); - this.cv = cv; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - if ( - /*name.equals("onPlayerTickEventClient") || */ name.equals("onPostLoad")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Found method " + name + ", removing."); - methodVisitor = null; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - return methodVisitor; - } - } - - public byte[] getByteArray() { - if (mTooledClass != null) { - return mTooledClass; - } - return getWriter().toByteArray(); - } - - private static final Map<UUID, Long> aTimeMap = new HashMap<UUID, Long>(); - - public static void onPlayerTickEventClient(PlayerTickEvent aEvent) { - if (aEvent.side.isClient() && aEvent.phase == Phase.END && !aEvent.player.isDead) { - long aTime = 0; - if (aTimeMap.get(aEvent.player.getUniqueID()) == null) { - aTimeMap.put(aEvent.player.getUniqueID(), 0l); - } else { - aTime = aTimeMap.get(aEvent.player.getUniqueID()) + 1; - aTimeMap.put(aEvent.player.getUniqueID(), aTime); - } - if (aTime >= 100L) { - aTimeMap.put(aEvent.player.getUniqueID(), 0l); - /** - * Remove original handling - */ - if (StaticFields59.mAssLineVisualMapNEI != null) { - StatFileWriter tList = Minecraft.getMinecraft().thePlayer.getStatFileWriter(); - GT_Recipe_Map aAssLineNei; - try { - aAssLineNei = (GT_Recipe_Map) StaticFields59.mAssLineVisualMapNEI.get(null); - for (GT_Recipe aFakeAssLineRecipe : aAssLineNei.mRecipeList) { - String aSafeUnlocalName; - if (aFakeAssLineRecipe.getOutput(0) == null) { - Logger.INFO( - "Someone tried to register an achievement for a recipe with null output. Please report this to Alkalus."); - continue; - } - ItemStack aStack = aFakeAssLineRecipe.getOutput(0); - try { - aSafeUnlocalName = aStack.getUnlocalizedName(); - } catch (Throwable t) { - aSafeUnlocalName = ItemUtils.getUnlocalizedItemName(aStack); - } - boolean aHidden = true; - try { - aHidden = tList.hasAchievementUnlocked( - AssLineAchievements.getAchievement(aSafeUnlocalName)); - Logger.INFO("Found achievement for " + aSafeUnlocalName); - } catch (NullPointerException rrr) { - aHidden = true; - // Logger.INFO("Exception handling achievement for "+aSafeUnlocalName); - // rrr.printStackTrace(); - } - aFakeAssLineRecipe.mHidden = !aHidden; - } - } catch (IllegalArgumentException | IllegalAccessException e) { - } - } - } - - Iterator tKey; - ArrayList arg5 = new ArrayList(); - tKey = GT_Utility.sPlayedSoundMap.entrySet().iterator(); - - while (tKey.hasNext()) { - Entry arg7 = (Entry) tKey.next(); - if (((Integer) arg7.getValue()).intValue() < 0) { - arg5.add(arg7.getKey()); - } else { - arg7.setValue(Integer.valueOf(((Integer) arg7.getValue()).intValue() - 1)); - } - } - - Iterator arg8 = arg5.iterator(); - - while (arg8.hasNext()) { - GT_PlayedSound arg6 = (GT_PlayedSound) arg8.next(); - GT_Utility.sPlayedSoundMap.remove(arg6); - } - - if (!GregTech_API.mServerStarted) { - GregTech_API.mServerStarted = true; - } - } - } - - /** - * GT_Client's onPostLoad - */ - public static void onPostLoad() { - try { - for (int i = 0; i < GregTech_API.METATILEENTITIES.length; i++) { - try { - if (GregTech_API.METATILEENTITIES[i] != null) { - GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip((EntityPlayer) null, true); - } - } catch (Throwable t) { - GT_Log.err.println("Error in MetaTileEntity with ID of " + i); - t.printStackTrace(GT_Log.err); - } - } - } catch (Throwable var2) { - var2.printStackTrace(); - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_ItemMachines_Tooltip.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_ItemMachines_Tooltip.java deleted file mode 100644 index 473b763738..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_ItemMachines_Tooltip.java +++ /dev/null @@ -1,153 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gtPlusPlus.preloader.DevHelper; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_ItemMachines_Tooltip { - - // The qualified name of the class we plan to transform. - private static final String className = "gregtech.common.blocks.GT_Item_Machines"; - // gregtech/common/blocks/GT_Item_Machines - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - String aEntityPlayer; - String aItemStack; - String aWorld; - - private static boolean doesMethodAlreadyExist = false; - - public ClassTransformer_GT_ItemMachines_Tooltip(byte[] basicClass, boolean obfuscated) { - - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new localClassVisitor(aTempWriter), 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null && !doesMethodAlreadyExist) { - aEntityPlayer = obfuscated - ? DevHelper.getObfuscated("net/minecraft/entity/player/EntityPlayer") - : "net/minecraft/entity/player/EntityPlayer"; - aItemStack = obfuscated - ? DevHelper.getObfuscated("net/minecraft/item/ItemStack") - : "net/minecraft/item/ItemStack"; - aWorld = obfuscated ? DevHelper.getObfuscated("net/minecraft/world/World") : "net/minecraft/world/World"; - - injectMethod("addInformation"); - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public void injectMethod(String aMethodName) { - MethodVisitor mv; - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Tooltip Patch", - Level.INFO, - "Injecting " + aMethodName + " into " + className + "."); - if (aMethodName.equals("addInformation")) { - - mv = getWriter() - .visitMethod( - ACC_PUBLIC, - "addInformation", - "(L" + aItemStack + ";L" + aEntityPlayer + ";Ljava/util/List;Z)V", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - Label l1 = new Label(); - Label l2 = new Label(); - mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable"); - mv.visitLabel(l0); - mv.visitLineNumber(120, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ALOAD, 3); - mv.visitVarInsn(ILOAD, 4); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy", - "conStructGtTileBlockTooltip", - "(L" + aItemStack + ";L" + aEntityPlayer + ";Ljava/util/List;Z)V", - false); - mv.visitLabel(l1); - mv.visitLineNumber(121, l1); - Label l3 = new Label(); - mv.visitJumpInsn(GOTO, l3); - mv.visitLabel(l2); - mv.visitFrame(F_SAME1, 0, null, 1, new Object[] {"java/lang/Throwable"}); - mv.visitVarInsn(ASTORE, 5); - Label l4 = new Label(); - mv.visitLabel(l4); - mv.visitLineNumber(122, l4); - mv.visitVarInsn(ALOAD, 5); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "java/lang/Throwable", "printStackTrace", "(Ljava/io/PrintStream;)V", false); - mv.visitLabel(l3); - mv.visitLineNumber(124, l3); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(RETURN); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLocalVariable("this", "Lgregtech/common/blocks/GT_Item_Machines;", null, l0, l5, 0); - mv.visitLocalVariable("aStack", "L" + aItemStack + ";", null, l0, l5, 1); - mv.visitLocalVariable("aPlayer", "L" + aEntityPlayer + ";", null, l0, l5, 2); - mv.visitLocalVariable("aList", "Ljava/util/List;", null, l0, l5, 3); - mv.visitLocalVariable("par4", "Z", null, l0, l5, 4); - mv.visitLocalVariable("e", "Ljava/lang/Throwable;", null, l4, l3, 5); - mv.visitMaxs(4, 6); - mv.visitEnd(); - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech Tooltip Patch", Level.INFO, "Method injection complete."); - } - - public static final class localClassVisitor extends ClassVisitor { - - public localClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - if (name.equals("addInformation")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech Tooltip Patch", Level.INFO, "Found method " + name + ", Patching."); - return null; - } - MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java deleted file mode 100644 index 65229e3b1d..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_MetaGenerated_Tool.java +++ /dev/null @@ -1,124 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.ACC_FINAL; -import static org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static org.objectweb.asm.Opcodes.ALOAD; -import static org.objectweb.asm.Opcodes.ASM5; -import static org.objectweb.asm.Opcodes.INVOKESTATIC; -import static org.objectweb.asm.Opcodes.RETURN; - -import gtPlusPlus.preloader.Preloader_Logger; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_MetaGenerated_Tool { - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - public ClassTransformer_GT_MetaGenerated_Tool(byte[] basicClass) { - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new LocalClassVisitor(aTempWriter), 0); - boolean completed = injectMethod("getSubItems", aTempWriter); - if (aTempReader != null && aTempWriter != null && completed) { - isValid = true; - } else { - isValid = false; - } - Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Valid? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName, ClassWriter cw) { - MethodVisitor mv; - boolean didInject = false; - Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Injecting " + aMethodName + "."); - if (aMethodName.equals("getSubItems")) { - { - mv = cw.visitMethod( - ACC_PUBLIC + ACC_FINAL, - "getSubItems", - "(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", - null, - null); - { - AnnotationVisitor av0 = mv.visitAnnotation("Lcpw/mods/fml/relauncher/SideOnly;", true); - av0.visitEnum("value", "Lcpw/mods/fml/relauncher/Side;", "CLIENT"); - av0.visitEnd(); - } - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(321, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 2); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/preloader/asm/helpers/MethodHelper_GT", - "getSubItems", - "(Lgregtech/api/items/GT_MetaGenerated_Tool;Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V", - false); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(322, l1); - mv.visitInsn(RETURN); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/api/items/GT_MetaGenerated_Tool;", null, l0, l2, 0); - mv.visitLocalVariable("var1", "Lnet/minecraft/item/Item;", null, l0, l2, 1); - mv.visitLocalVariable("aCreativeTab", "Lnet/minecraft/creativetab/CreativeTabs;", null, l0, l2, 2); - mv.visitLocalVariable("aList", "Ljava/util/List;", null, l0, l2, 3); - mv.visitMaxs(4, 4); - mv.visitEnd(); - didInject = true; - } - } - Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Method injection complete."); - return didInject; - } - - public final class LocalClassVisitor extends ClassVisitor { - - public LocalClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - if (name.equals("getSubItems") - && desc.equals( - "(Lnet/minecraft/item/Item;Lnet/minecraft/creativetab/CreativeTabs;Ljava/util/List;)V")) { - methodVisitor = null; - Preloader_Logger.LOG("GT Tool Fix", Level.INFO, "Found method " + name + ", removing."); - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Packet_TileEntity.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Packet_TileEntity.java deleted file mode 100644 index 94be6ef3ec..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Packet_TileEntity.java +++ /dev/null @@ -1,373 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_Packet_TileEntity { - - // The qualified name of the class we plan to transform. - // gregtech/common/blocks/GT_Block_Machines - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - - public ClassTransformer_GT_Packet_TileEntity(byte[] basicClass, boolean obfuscated) { - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Attempting to make GT Packets safer."); - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new localClassVisitor(aTempWriter), 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Valid patch? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Attempting Method Injection."); - injectMethod("process", obfuscated); - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName, boolean obfuscated) { - MethodVisitor mv; - boolean didInject = false; - String aGetTile = obfuscated ? "func_147438_o" : "getTileEntity"; - - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Injecting " + aMethodName + "."); - if (aMethodName.equals("process")) { - mv = getWriter().visitMethod(ACC_PUBLIC, "process", "(Lnet/minecraft/world/IBlockAccess;)V", null, null); - mv.visitCode(); - Label l0 = new Label(); - Label l1 = new Label(); - Label l2 = new Label(); - mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable"); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLineNumber(93, l3); - mv.visitVarInsn(ALOAD, 1); - Label l4 = new Label(); - mv.visitJumpInsn(IFNULL, l4); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(94, l5); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mX", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mY", "S"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mZ", "I"); - mv.visitMethodInsn( - INVOKEINTERFACE, - "net/minecraft/world/IBlockAccess", - "" + aGetTile + "", - "(III)Lnet/minecraft/tileentity/TileEntity;", - true); - mv.visitVarInsn(ASTORE, 2); - Label l6 = new Label(); - mv.visitLabel(l6); - mv.visitLineNumber(95, l6); - mv.visitVarInsn(ALOAD, 2); - mv.visitJumpInsn(IFNULL, l4); - mv.visitLabel(l0); - mv.visitLineNumber(97, l0); - mv.visitVarInsn(ALOAD, 2); - mv.visitTypeInsn(INSTANCEOF, "gregtech/api/metatileentity/BaseMetaTileEntity"); - Label l7 = new Label(); - mv.visitJumpInsn(IFEQ, l7); - Label l8 = new Label(); - mv.visitLabel(l8); - mv.visitLineNumber(98, l8); - mv.visitVarInsn(ALOAD, 2); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/metatileentity/BaseMetaTileEntity"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mID", "S"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC0", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC1", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC2", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC3", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC4", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC5", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mTexture", "B"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mTexturePage", "B"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mUpdate", "B"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mRedstone", "B"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mColor", "B"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/metatileentity/BaseMetaTileEntity", - "receiveMetaTileEntityData", - "(SIIIIIIBBBBB)V", - false); - Label l9 = new Label(); - mv.visitLabel(l9); - mv.visitLineNumber(99, l9); - mv.visitJumpInsn(GOTO, l4); - mv.visitLabel(l7); - mv.visitLineNumber(101, l7); - mv.visitFrame(F_APPEND, 1, new Object[] {"net/minecraft/tileentity/TileEntity"}, 0, null); - mv.visitVarInsn(ALOAD, 2); - mv.visitTypeInsn(INSTANCEOF, "gregtech/api/metatileentity/BaseMetaPipeEntity"); - mv.visitJumpInsn(IFEQ, l4); - Label l10 = new Label(); - mv.visitLabel(l10); - mv.visitLineNumber(102, l10); - mv.visitVarInsn(ALOAD, 2); - mv.visitTypeInsn(CHECKCAST, "gregtech/api/metatileentity/BaseMetaPipeEntity"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mID", "S"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC0", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC1", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC2", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC3", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC4", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mC5", "I"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mTexture", "B"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mUpdate", "B"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mRedstone", "B"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mColor", "B"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "gregtech/api/metatileentity/BaseMetaPipeEntity", - "receiveMetaTileEntityData", - "(SIIIIIIBBBB)V", - false); - mv.visitLabel(l1); - mv.visitLineNumber(104, l1); - mv.visitJumpInsn(GOTO, l4); - mv.visitLabel(l2); - mv.visitLineNumber(105, l2); - mv.visitFrame(F_SAME1, 0, null, 1, new Object[] {"java/lang/Throwable"}); - mv.visitVarInsn(ASTORE, 3); - Label l11 = new Label(); - mv.visitLabel(l11); - mv.visitLineNumber(106, l11); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitTypeInsn(NEW, "java/lang/StringBuilder"); - mv.visitInsn(DUP); - mv.visitLdcInsn( - "[GTPTE] Bad Tile Entity set in world, your game would have crashed if not for me! Was Null? "); - mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V", false); - mv.visitVarInsn(ALOAD, 2); - Label l12 = new Label(); - mv.visitJumpInsn(IFNONNULL, l12); - mv.visitInsn(ICONST_1); - Label l13 = new Label(); - mv.visitJumpInsn(GOTO, l13); - mv.visitLabel(l12); - mv.visitFrame( - F_FULL, - 4, - new Object[] { - "gregtech/api/net/GT_Packet_TileEntity", - "net/minecraft/world/IBlockAccess", - "net/minecraft/tileentity/TileEntity", - "java/lang/Throwable" - }, - 2, - new Object[] {"java/io/PrintStream", "java/lang/StringBuilder"}); - mv.visitInsn(ICONST_0); - mv.visitLabel(l13); - mv.visitFrame( - F_FULL, - 4, - new Object[] { - "gregtech/api/net/GT_Packet_TileEntity", - "net/minecraft/world/IBlockAccess", - "net/minecraft/tileentity/TileEntity", - "java/lang/Throwable" - }, - 3, - new Object[] {"java/io/PrintStream", "java/lang/StringBuilder", INTEGER}); - mv.visitMethodInsn( - INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Z)Ljava/lang/StringBuilder;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - Label l14 = new Label(); - mv.visitLabel(l14); - mv.visitLineNumber(107, l14); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitTypeInsn(NEW, "java/lang/StringBuilder"); - mv.visitInsn(DUP); - mv.visitLdcInsn("Tile location ["); - mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V", false); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mX", "I"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(I)Ljava/lang/StringBuilder;", false); - mv.visitLdcInsn("]["); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "java/lang/StringBuilder", - "append", - "(Ljava/lang/String;)Ljava/lang/StringBuilder;", - false); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mY", "S"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(I)Ljava/lang/StringBuilder;", false); - mv.visitLdcInsn("]["); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "java/lang/StringBuilder", - "append", - "(Ljava/lang/String;)Ljava/lang/StringBuilder;", - false); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "gregtech/api/net/GT_Packet_TileEntity", "mZ", "I"); - mv.visitMethodInsn( - INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(I)Ljava/lang/StringBuilder;", false); - mv.visitLdcInsn("]"); - mv.visitMethodInsn( - INVOKEVIRTUAL, - "java/lang/StringBuilder", - "append", - "(Ljava/lang/String;)Ljava/lang/StringBuilder;", - false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - Label l15 = new Label(); - mv.visitLabel(l15); - mv.visitLineNumber(108, l15); - mv.visitVarInsn(ALOAD, 2); - Label l16 = new Label(); - mv.visitJumpInsn(IFNULL, l16); - Label l17 = new Label(); - mv.visitLabel(l17); - mv.visitLineNumber(109, l17); - mv.visitVarInsn(ALOAD, 2); - mv.visitTypeInsn(INSTANCEOF, "gregtech/api/metatileentity/BaseMetaPipeEntity"); - Label l18 = new Label(); - mv.visitJumpInsn(IFEQ, l18); - Label l19 = new Label(); - mv.visitLabel(l19); - mv.visitLineNumber(110, l19); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitLdcInsn("Type: Pipe"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - Label l20 = new Label(); - mv.visitLabel(l20); - mv.visitLineNumber(111, l20); - mv.visitJumpInsn(GOTO, l16); - mv.visitLabel(l18); - mv.visitLineNumber(112, l18); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 2); - mv.visitTypeInsn(INSTANCEOF, "gregtech/api/metatileentity/BaseMetaTileEntity"); - Label l21 = new Label(); - mv.visitJumpInsn(IFEQ, l21); - Label l22 = new Label(); - mv.visitLabel(l22); - mv.visitLineNumber(113, l22); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitLdcInsn("Type: Machine"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - Label l23 = new Label(); - mv.visitLabel(l23); - mv.visitLineNumber(114, l23); - mv.visitJumpInsn(GOTO, l16); - mv.visitLabel(l21); - mv.visitLineNumber(116, l21); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Log", "err", "Ljava/io/PrintStream;"); - mv.visitLdcInsn("Type: Non-GT (Could be GT++/TT/BW)"); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); - mv.visitLabel(l16); - mv.visitLineNumber(119, l16); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Throwable", "printStackTrace", "()V", false); - mv.visitLabel(l4); - mv.visitLineNumber(123, l4); - mv.visitFrame(F_CHOP, 2, null, 0, null); - mv.visitInsn(RETURN); - Label l24 = new Label(); - mv.visitLabel(l24); - mv.visitLocalVariable("this", "Lgregtech/api/net/GT_Packet_TileEntity;", null, l3, l24, 0); - mv.visitLocalVariable("aWorld", "Lnet/minecraft/world/IBlockAccess;", null, l3, l24, 1); - mv.visitLocalVariable("tTileEntity", "Lnet/minecraft/tileentity/TileEntity;", null, l6, l4, 2); - mv.visitLocalVariable("t", "Ljava/lang/Throwable;", null, l11, l4, 3); - mv.visitMaxs(13, 4); - mv.visitEnd(); - - didInject = true; - } - FMLRelaunchLog.log("[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public final class localClassVisitor extends ClassVisitor { - - public localClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - if (name.equals("process")) { - FMLRelaunchLog.log( - "[GT++ ASM] Gregtech GT_Packet_TileEntity Patch", - Level.INFO, - "Found method " + name + ", removing."); - methodVisitor = null; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java deleted file mode 100644 index 92300bd3d1..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java +++ /dev/null @@ -1,337 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.preloader.Preloader_Logger; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -public class ClassTransformer_GT_Utility { - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - private final String className; - - public ClassTransformer_GT_Utility(byte[] basicClass, String aClassName) { - - className = aClassName; - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new localClassVisitor(aTempWriter, className), 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Valid patch? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Attempting Method Injection."); - injectMethod("getTier"); - injectMethod("applyRadioactivity"); - injectMethod("isWearingFullFrostHazmat"); - injectMethod("isWearingFullHeatHazmat"); - injectMethod("isWearingFullBioHazmat"); - injectMethod("isWearingFullRadioHazmat"); - injectMethod("isWearingFullElectroHazmat"); - injectMethod("isWearingFullGasHazmat"); - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName) { - MethodVisitor mv; - boolean didInject = false; - ClassWriter cw = getWriter(); - String aClassNameFormatted = Utils.class.getName().replace(".", "/"); - - if (aMethodName.equals("isWearingFullFrostHazmat")) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, - "isWearingFullFrostHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(1273, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/EntityUtils", - "isWearingFullFrostHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("aEntity", "Lnet/minecraft/entity/EntityLivingBase;", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - - if (aMethodName.equals("isWearingFullHeatHazmat")) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, - "isWearingFullHeatHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(1277, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/EntityUtils", - "isWearingFullHeatHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("aEntity", "Lnet/minecraft/entity/EntityLivingBase;", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - - if (aMethodName.equals("isWearingFullBioHazmat")) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, - "isWearingFullBioHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(1281, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/EntityUtils", - "isWearingFullBioHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("aEntity", "Lnet/minecraft/entity/EntityLivingBase;", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - - if (aMethodName.equals("isWearingFullRadioHazmat")) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, - "isWearingFullRadioHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(1285, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/EntityUtils", - "isWearingFullRadioHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("aEntity", "Lnet/minecraft/entity/EntityLivingBase;", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - - if (aMethodName.equals("isWearingFullElectroHazmat")) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, - "isWearingFullElectroHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(1289, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/EntityUtils", - "isWearingFullElectroHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("aEntity", "Lnet/minecraft/entity/EntityLivingBase;", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - - if (aMethodName.equals("isWearingFullGasHazmat")) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, - "isWearingFullGasHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(1293, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/EntityUtils", - "isWearingFullGasHazmat", - "(Lnet/minecraft/entity/EntityLivingBase;)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("aEntity", "Lnet/minecraft/entity/EntityLivingBase;", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - - if (aMethodName.equals("getTier")) { - Preloader_Logger.LOG( - "Gregtech Utilities Patch", - Level.INFO, - "Injecting " + aMethodName + ", static replacement call to " + aClassNameFormatted + "."); - mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "getTier", "(J)B", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(23, l0); - mv.visitVarInsn(LLOAD, 0); - mv.visitMethodInsn(INVOKESTATIC, aClassNameFormatted, "getTier", "(J)B", false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("l", "J", null, l0, l1, 0); - mv.visitMaxs(2, 2); - mv.visitEnd(); - didInject = true; - } - - if (aMethodName.equals("applyRadioactivity")) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + "."); - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, - "applyRadioactivity", - "(Lnet/minecraft/entity/EntityLivingBase;II)Z", - null, - null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(1342, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ILOAD, 1); - mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/EntityUtils", - "applyRadioactivity", - "(Lnet/minecraft/entity/EntityLivingBase;II)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("aEntity", "Lnet/minecraft/entity/EntityLivingBase;", null, l0, l1, 0); - mv.visitLocalVariable("aLevel", "I", null, l0, l1, 1); - mv.visitLocalVariable("aAmountOfItems", "I", null, l0, l1, 2); - mv.visitMaxs(3, 3); - mv.visitEnd(); - didInject = true; - } - - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public final class localClassVisitor extends ClassVisitor { - - String aClassName; - - public localClassVisitor(ClassVisitor cv, String aName) { - super(ASM5, cv); - aClassName = aName; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - - if (name.equals("getTier")) { - methodVisitor = null; - } else if (name.equals("applyRadioactivity")) { - methodVisitor = null; - } else if (name.equals("isWearingFullFrostHazmat")) { - methodVisitor = null; - } else if (name.equals("isWearingFullHeatHazmat")) { - methodVisitor = null; - } else if (name.equals("isWearingFullBioHazmat")) { - methodVisitor = null; - } else if (name.equals("isWearingFullRadioHazmat")) { - methodVisitor = null; - } else if (name.equals("isWearingFullElectroHazmat")) { - methodVisitor = null; - } else if (name.equals("isWearingFullGasHazmat")) { - methodVisitor = null; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - - if (methodVisitor == null) { - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Found method " + name + ", removing."); - Preloader_Logger.LOG("Gregtech Utilities Patch", Level.INFO, "Descriptor: " + desc); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java deleted file mode 100644 index a3c1d105d7..0000000000 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java +++ /dev/null @@ -1,147 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gtPlusPlus.core.util.minecraft.HazmatUtils; -import net.minecraft.entity.EntityLivingBase; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.*; - -public class ClassTransformer_IC2_Hazmat { - - private final boolean isValid; - private final ClassReader reader; - private final ClassWriter writer; - private final String className; - - public static boolean hasCompleteHazmat(EntityLivingBase living) { - return HazmatUtils.hasCompleteHazmat(living); - } - - public ClassTransformer_IC2_Hazmat(byte[] basicClass, String aClassName) { - className = aClassName; - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Attempting to patch in mode " + className + "."); - - aTempReader = new ClassReader(basicClass); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - aTempReader.accept(new localClassVisitor(aTempWriter, className), 0); - - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } else { - isValid = false; - } - - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Valid patch? " + isValid + "."); - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null) { - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Attempting Method Injection."); - injectMethod("hasCompleteHazmat"); - } - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public boolean injectMethod(String aMethodName) { - MethodVisitor mv; - boolean didInject = false; - ClassWriter cw = getWriter(); - - boolean isObf; - try { - isObf = Class.forName("net.minecraft.entity.EntityLivingBase") == null; - } catch (ClassNotFoundException e) { - isObf = true; - } - String aEntityLivingBase = "net/minecraft/entity/EntityLivingBase"; - if (isObf) { - aEntityLivingBase = "sv"; - } - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Method Handler: " + aEntityLivingBase); - - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Injecting " + aMethodName + "."); - if (aMethodName.equals("hasCompleteHazmat")) { - - // Bad Local Variable - https://pastebin.com/TUCfdHqS - /*mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "hasCompleteHazmat", "(L"+aEntityLivingBase+";)Z", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(23, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/core/util/minecraft/HazmatUtils", "hasCompleteHazmat", "(L"+aEntityLivingBase+";)Z", false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "Lic2/core/item/armor/ItemArmorHazmat;", null, l0, l1, 0); - mv.visitLocalVariable("living", "L"+aEntityLivingBase+";", null, l0, l1, 1); - mv.visitMaxs(1, 2); - mv.visitEnd();*/ - - mv = cw.visitMethod( - ACC_PUBLIC + ACC_STATIC, "hasCompleteHazmat", "(L" + aEntityLivingBase + ";)Z", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(24, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn( - INVOKESTATIC, - "gtPlusPlus/core/util/minecraft/HazmatUtils", - "hasCompleteHazmat", - "(L" + aEntityLivingBase + ";)Z", - false); - mv.visitInsn(IRETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("living", "L" + aEntityLivingBase + ";", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - didInject = true; - } - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Method injection complete."); - return didInject; - } - - public final class localClassVisitor extends ClassVisitor { - - String aClassName; - - public localClassVisitor(ClassVisitor cv, String aName) { - super(ASM5, cv); - aClassName = aName; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor methodVisitor; - - if (name.equals("hasCompleteHazmat")) { - methodVisitor = null; - } else { - methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - } - - if (methodVisitor == null) { - FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Found method " + name + ", removing."); - } - return methodVisitor; - } - } -} diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java index ceaebe8740..b9eb5d6096 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/main/java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -5,7 +5,6 @@ import static gtPlusPlus.preloader.asm.ClassesToTransform.*; import cpw.mods.fml.relauncher.CoreModManager; import cpw.mods.fml.relauncher.ReflectionHelper; import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.DevHelper; import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.AsmConfig; @@ -75,25 +74,6 @@ public class Preloader_Transformer_Handler implements IClassTransformer { } public byte[] transform(String name, String transformedName, byte[] basicClass) { - /* - * Here we patch all instances of entity.setHealth and replace them with a static function. - * Only EntityLivingBase is left untouched, as nothing else truly needs to be calling this method and avoiding forge hooks. - * May exclude all vanilla/forge class if this causes issues though. - */ - /* PatchForge : if (AsmConfig.enabledFixEntitySetHealth && !transformedName.contains("gtPlusPlus.preloader")) { - - //Skip Vanilla/Forge Classes - if (transformedName.contains("net.minecraft.") || transformedName.contains("cpw.")) { - //break PatchForge; - } - - ClassTransformer_Forge_EntityLivingBase_SetHealth aForgeHealthFix = new ClassTransformer_Forge_EntityLivingBase_SetHealth(transformedName, basicClass); - if (aForgeHealthFix.isValidTransformer() && aForgeHealthFix.didPatchClass()) { - Preloader_Logger.INFO("Fix EntityLivingBase.setHealth misuse", "Transforming "+transformedName); - basicClass = aForgeHealthFix.getWriter().toByteArray(); - } - }*/ - // Is this environment obfuscated? (Extra checks just in case some weird shit happens during the check) final boolean obfuscated = checkObfuscated(); @@ -128,11 +108,6 @@ public class Preloader_Transformer_Handler implements IClassTransformer { return classWriter.toByteArray(); } - // Log Handling of CodeChicken - if (transformedName.equals("codechicken.nei.guihook.GuiContainerManager")) { - // Preloader_Logger.INFO("CodeChicken GuiContainerManager Patch", "Transforming "+transformedName); - // return new ClassTransformer_CC_GuiContainerManager(basicClass).getWriter().toByteArray(); - } // Fix the OreDictionary COFH if (transformedName.equals(COFH_ORE_DICTIONARY_ARBITER) && (AsmConfig.enableCofhPatch || !obfuscated)) { Preloader_Logger.INFO("COFH", "Transforming " + transformedName); @@ -171,92 +146,6 @@ public class Preloader_Transformer_Handler implements IClassTransformer { } } - /** - * Gregtech ASM Patches - */ - - // if (transformedName.equals(GT_UTILITY)) { - // Preloader_Logger.INFO("Gregtech Utilities Patch", "Transforming "+transformedName); - // return new ClassTransformer_GT_Utility(basicClass, transformedName).getWriter().toByteArray(); - // } - // Try patch achievements - if (transformedName.equals(GT_ACHIEVEMENTS)) { - Preloader_Logger.INFO("Gregtech Achievements Patch", "Transforming " + transformedName); - return new ClassTransformer_GT_Achievements_CrashFix(basicClass, obfuscated) - .getWriter() - .toByteArray(); - } - - // Fix bad handling of a loop left from original decompilation - // Also Fix Achievements, although currently disabled. - if (transformedName.equals(GT_CLIENT_PROXY)) { - Preloader_Logger.INFO("Gregtech Client Proxy Patch", "Transforming " + transformedName); - return new ClassTransformer_GT_Client(basicClass, obfuscated).getByteArray(); - } - - // Make GT packets safer, fill them with debug info. - if (transformedName.equals(GT_PACKET_TILE_ENTITY)) { - Preloader_Logger.INFO("Gregtech GT_Packet_TileEntity Patch", "Transforming " + transformedName); - return new ClassTransformer_GT_Packet_TileEntity(basicClass, obfuscated) - .getWriter() - .toByteArray(); - } - // Make the setting of GT Tiles safer, so as not to crash the client. - if (transformedName.equals(GT_BASE_META_TILE_ENTITY)) { - Preloader_Logger.INFO("Gregtech setMetaTileEntity Patch", "Transforming " + transformedName); - return new ClassTransformer_GT_BaseMetaTileEntity(basicClass) - .getWriter() - .toByteArray(); - } - // Add extra tools if we're in a dev environment. - if (transformedName.equals(GT_METAGENERATED_TOOL) && CORE_Preloader.DEV_ENVIRONMENT) { - Preloader_Logger.INFO("Gregtech Additional Tools Patch", "Transforming " + transformedName); - return new ClassTransformer_GT_MetaGenerated_Tool(basicClass) - .getWriter() - .toByteArray(); - } - // Fix log handling on the charcoal pit - if (transformedName.equals(GT_MTE_CHARCOAL_PIT) && AsmConfig.enableGtCharcoalPitFix) { - Preloader_Logger.INFO("GT Charcoal Pit Fix", "Transforming " + transformedName); - return new ClassTransformer_GT_CharcoalPit(basicClass, obfuscated) - .getWriter() - .toByteArray(); - } - - // Patching Meta Tile Tooltips - if (transformedName.equals(GT_ITEM_MACHINES) && AsmConfig.enableGtTooltipFix) { - // Preloader_Logger.INFO("Gregtech Tooltip Patch", "Transforming "+transformedName); - // return new ClassTransformer_GT_ItemMachines_Tooltip(basicClass, false).getWriter().toByteArray(); - } - - if (transformedName.equals(GT_BLOCK_MACHINES)) { - // Fix GT NBT Persistency issue - Preloader_Logger.INFO("Gregtech NBT Persistency Patch", "Transforming " + transformedName); - byte[] g = new ClassTransformer_GT_BlockMachines_NBT(basicClass, false) - .getWriter() - .toByteArray(); - Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming " + transformedName); - return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(g, 0) - .getWriter() - .toByteArray(); - } - if (transformedName.equals(GT_METAPIPE_ITEM) - || transformedName.equals(GT_METAPIPE_FRAME) - || transformedName.equals(GT_METAPIPE_FLUID)) { - Preloader_Logger.INFO("Gregtech getTileEntityBaseType Patch", "Transforming " + transformedName); - int mode = 0; - if (transformedName.equals(GT_METAPIPE_ITEM)) { - mode = 1; - } else if (transformedName.equals(GT_METAPIPE_FRAME)) { - mode = 2; - } else { - mode = 3; - } - return new ClassTransformer_GT_BlockMachines_MetaPipeEntity(basicClass, mode) - .getWriter() - .toByteArray(); - } - // Fix IC2 Wrench Harvesting for (String y : IC2_WRENCH_PATCH_CLASS_NAMES) { if (transformedName.equals(y)) { @@ -267,12 +156,6 @@ public class Preloader_Transformer_Handler implements IClassTransformer { } } - // This is breaking IC2 Hazmat, moved to hodgepodge - // if (transformedName.equals(IC2_ITEM_ARMOUR_HAZMAT)) { - // Preloader_Logger.INFO("IC2 Hazmat Patch", "Transforming "+transformedName); - // return new ClassTransformer_IC2_Hazmat(basicClass, transformedName).getWriter().toByteArray(); - // } - // Fix Thaumcraft Shit // Patching ItemWispEssence to allow invalid item handling if (transformedName.equals(THAUMCRAFT_ITEM_WISP_ESSENCE) && AsmConfig.enableTcAspectSafety) { @@ -281,11 +164,6 @@ public class Preloader_Transformer_Handler implements IClassTransformer { .getWriter() .toByteArray(); } - // Fix Thaumic Tinkerer Shit - if (transformedName.equals(THAUMICTINKERER_TILE_REPAIRER) && AsmConfig.enableThaumicTinkererRepairFix) { - // Preloader_Logger.INFO("Thaumic Tinkerer RepairItem Patch", "Transforming "+transformedName); - // return new ClassTransformer_TT_ThaumicRestorer(basicClass).getWriter().toByteArray(); - } return basicClass; } |