diff options
| author | Alkalus <draknyte1@hotmail.com> | 2020-03-31 02:40:07 +0000 |
|---|---|---|
| committer | Alkalus <draknyte1@hotmail.com> | 2020-03-31 02:40:07 +0000 |
| commit | 6d6adf8039fb97f2025610eb313a4caa48df838b (patch) | |
| tree | 80e377c85c8a89edeac671cc6b2f2655a150f41e /src/Java/gtPlusPlus/preloader/asm | |
| parent | 47816dec7729bde0bf247ff7db8ebf6b25b92048 (diff) | |
| parent | 8a8048a6418ca8da9de0bd7b49f6ec39f9b0aad6 (diff) | |
| download | GT5-Unofficial-6d6adf8039fb97f2025610eb313a4caa48df838b.tar.gz GT5-Unofficial-6d6adf8039fb97f2025610eb313a4caa48df838b.tar.bz2 GT5-Unofficial-6d6adf8039fb97f2025610eb313a4caa48df838b.zip | |
Merged in AlkWork (pull request #4)
AlkWork
Diffstat (limited to 'src/Java/gtPlusPlus/preloader/asm')
13 files changed, 549 insertions, 545 deletions
diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index 87ac77d5da..d0c59726de 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -1,6 +1,8 @@ package gtPlusPlus.preloader.asm; import cpw.mods.fml.common.FMLLog; +import gtPlusPlus.preloader.Preloader_Logger; + import java.io.File; import java.util.ArrayList; import net.minecraftforge.common.config.Configuration; @@ -11,7 +13,8 @@ public class AsmConfig { public static boolean loaded; public static Configuration config; - + + public static boolean enableOreDictPatch; public static boolean enableTiConFluidLighting; public static boolean enableGtTooltipFix; public static boolean enableGtNbtFix; @@ -27,8 +30,9 @@ public class AsmConfig { public static boolean enableTcAspectSafety; public static boolean enabledLwjglKeybindingFix; public static boolean enabledFixEntitySetHealth; - + public static boolean disableAllLogging; + public static boolean debugMode; public AsmConfig(File file) { if (!loaded) { @@ -56,6 +60,12 @@ public class AsmConfig { disableAllLogging = prop.getBoolean(false); propOrderDebug.add(prop.getName()); + prop = config.get("debug", "debugMode", false); + prop.comment = "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)"; + prop.setLanguageKey("gtpp.debugMode").setRequiresMcRestart(false); + debugMode = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enabledFixEntitySetHealth", false); prop.comment = "Enable/Disable entity setHealth() fix."; prop.setLanguageKey("gtpp.enabledFixEntitySetHealth").setRequiresMcRestart(true); @@ -80,6 +90,12 @@ public class AsmConfig { enableCofhPatch = prop.getBoolean(false); propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enableOreDictPatch", false); + prop.comment = "Enable/Disable Forge OreDictionary Patch (Useful for Development)"; + prop.setLanguageKey("gtpp.enableOreDictPatch").setRequiresMcRestart(true); + enableOreDictPatch = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + @@ -168,15 +184,15 @@ public class AsmConfig { config.save(); } - FMLLog.log(Level.INFO, "[GT++ ASM] Chunk Debugging - Enabled: "+enableChunkDebugging, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gt Nbt Fix - Enabled: "+enableGtNbtFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gt Tooltip Fix - Enabled: "+enableGtTooltipFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] COFH Patch - Enabled: "+enableCofhPatch, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety, new Object[0]); - FMLLog.log(Level.INFO, "[GT++ ASM] Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth, new Object[0]); + Preloader_Logger.INFO("Chunk Debugging - Enabled: "+enableChunkDebugging); + Preloader_Logger.INFO("Gt Nbt Fix - Enabled: "+enableGtNbtFix); + Preloader_Logger.INFO("TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting); + Preloader_Logger.INFO("Gt Tooltip Fix - Enabled: "+enableGtTooltipFix); + Preloader_Logger.INFO("COFH Patch - Enabled: "+enableCofhPatch); + Preloader_Logger.INFO("Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges); + Preloader_Logger.INFO("Railcraft Fluid Flow Patch - Enabled: "+enableRcFlowFix); + Preloader_Logger.INFO("Thaumcraft Aspect Safety Patch - Enabled: "+enableTcAspectSafety); + Preloader_Logger.INFO("Fix bad usage of EntityLivingBase.setHealth Patch - Enabled: "+enabledFixEntitySetHealth); } catch (Exception var3) { FMLLog.log(Level.ERROR, var3, "GT++ ASM had a problem loading it's config", new Object[0]); diff --git a/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java new file mode 100644 index 0000000000..84593f6597 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/ClassesToTransform.java @@ -0,0 +1,74 @@ +package gtPlusPlus.preloader.asm; + +public class ClassesToTransform { + + + public static final String LWJGL_KEYBOARD = "org.lwjgl.input.Keyboard"; + + + public static final String MINECRAFT_GAMESETTINGS = "net.minecraft.client.settings.GameSettings"; + public static final String MINECRAFT_GAMESETTINGS_OBF = "bbj"; + + + public static final String FORGE_CHUNK_MANAGER = "net.minecraftforge.common.ForgeChunkManager"; + public static final String FORGE_ORE_DICTIONARY = "net.minecraftforge.oredict.OreDictionary"; + + + public static final String COFH_ORE_DICTIONARY_ARBITER = "cofh.core.util.oredict.OreDictionaryArbiter"; + + + public static final String TINKERS_FLUID_BLOCK = "tconstruct.smeltery.blocks.TConstructFluid"; + + + public static final String RAILCRAFT_FLUID_HELPER = "mods.railcraft.common.fluids.FluidHelper"; + public static final String RAILCRAFT_TILE_FLUID_LOADER = "mods.railcraft.common.blocks.machine.gamma.TileFluidLoader"; + public static final String RAILCRAFT_INVENTORY_TOOLS = "mods.railcraft.common.util.inventory.InvTools"; + + + public static final String GALACTICRAFT_FLUID_UTILS = "micdoodle8.mods.galacticraft.core.util.FluidUtil"; + public static final String GALACTICRAFT_TILE_ENTITY_FUEL_LOADER = "micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader"; + public static final String GALACTICRAFT_ENTITY_AUTO_ROCKET = "micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket"; + + + public static final String GT_UTILITY = "gregtech.api.util.GT_Utility"; + public static final String GT_ACHIEVEMENTS = "gregtech.loaders.misc.GT_Achievements"; + public static final String GT_CLIENT_PROXY = "gregtech.common.GT_Client"; + public static final String GT_PACKET_TILE_ENTITY = "gregtech.api.net.GT_Packet_TileEntity"; + public static final String GT_BASE_META_TILE_ENTITY = "gregtech.api.metatileentity.BaseMetaTileEntity"; + public static final String GT_MTE_CHARCOAL_PIT = "gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit"; + public static final String GT_ITEM_MACHINES = "gregtech.common.blocks.GT_Item_Machines"; + public static final String GT_METAGENERATED_TOOL = "gregtech.api.items.GT_MetaGenerated_Tool"; + public static final String GT_BLOCK_MACHINES = "gregtech.common.blocks.GT_Block_Machines"; + public static final String GT_MTE_HATCH_INPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus"; + public static final String GT_MTE_HATCH_OUTPUTBUS = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus"; + public static final String GT_METAPIPE_ITEM = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item"; + public static final String GT_METAPIPE_FLUID = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid"; + public static final String GT_METAPIPE_FRAME = "gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame"; + + + public static final String GTPP_MTE_HATCH_SUPER_INPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input"; + public static final String GTPP_MTE_HATCH_SUPER_OUTPUT_BUS = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output"; + public static final String NAME = ""; + + + public static final String THAUMCRAFT_ITEM_WISP_ESSENCE = "thaumcraft.common.items.ItemWispEssence"; + + public static final String IC2_ITEM_ARMOUR_HAZMAT = "ic2.core.item.armor.ItemArmorHazmat"; + public static final String IC2_BLOCK_BASE_TILE_ENTITY = "ic2.core.block.BlockTileEntity"; + public static final String IC2_BLOCK_MACHINE1 = "ic2.core.block.machine.BlockMachine"; + public static final String IC2_BLOCK_MACHINE2 = "ic2.core.block.machine.BlockMachine2"; + public static final String IC2_BLOCK_MACHINE3 = "ic2.core.block.machine.BlockMachine3"; + public static final String IC2_BLOCK_KINETIC_GENERATOR = "ic2.core.block.kineticgenerator.block.BlockKineticGenerator"; + public static final String IC2_BLOCK_HEAT_GENERATOR = "ic2.core.block.heatgenerator.block.BlockHeatGenerator"; + public static final String IC2_BLOCK_GENERATOR = "ic2.core.block.generator.block.BlockGenerator"; + public static final String IC2_BLOCK_REACTOR_ACCESS_HATCH = "ic2.core.block.reactor.block.BlockReactorAccessHatch"; + public static final String IC2_BLOCK_REACTOR_CHAMBER = "ic2.core.block.reactor.block.BlockReactorChamber"; + public static final String IC2_BLOCK_REACTOR_FLUID_PORT = "ic2.core.block.reactor.block.BlockReactorFluidPort"; + public static final String IC2_BLOCK_REACTOR_REDSTONE_PORT = "ic2.core.block.reactor.block.BlockReactorRedstonePort"; + public static final String IC2_BLOCK_REACTOR_VESSEL = "ic2.core.block.reactor.block.BlockReactorVessel"; + public static final String IC2_BLOCK_PERSONAL = "ic2.core.block.personal.BlockPersonal.class"; + public static final String IC2_BLOCK_CHARGEPAD = "ic2.core.block.wiring.BlockChargepad.class"; + public static final String IC2_BLOCK_ELECTRIC = "ic2.core.block.wiring.BlockElectric.class"; + public static final String IC2_BLOCK_LUMINATOR = "ic2.core.block.wiring.BlockLuminator.class"; + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java index d8a4bf96f5..2a0082754a 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java @@ -2,27 +2,24 @@ package gtPlusPlus.preloader.asm; import java.io.File; import java.util.Arrays; -import java.util.List; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.LoadController; -import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.ModMetadata; -import cpw.mods.fml.common.event.*; -import cpw.mods.fml.common.versioning.ArtifactVersion; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; +import cpw.mods.fml.common.event.FMLConstructionEvent; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; import net.minecraftforge.common.config.Configuration; public class Preloader_DummyContainer extends DummyModContainer { public Preloader_DummyContainer() { - super(new ModMetadata()); ModMetadata meta = getMetadata(); meta.modId = CORE_Preloader.MODID; @@ -35,7 +32,8 @@ public class Preloader_DummyContainer extends DummyModContainer { meta.updateUrl = ""; meta.screenshots = new String[0]; meta.logoFile = ""; - meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES; + //meta.dependencies = (List<ArtifactVersion>) CORE_Preloader.DEPENDENCIES; + Preloader_Logger.INFO("Initializing DummyModContainer"); } @@ -47,29 +45,26 @@ public class Preloader_DummyContainer extends DummyModContainer { @Subscribe public void modConstruction(FMLConstructionEvent evt){ - - } - - @Subscribe - public void init(FMLInitializationEvent evt) { + Preloader_Logger.INFO("Constructing DummyModContainer"); } - @EventHandler - public void load(final FMLInitializationEvent e) { - Logger.INFO("[GT++ ASM] Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); - } - @Subscribe public void preInit(FMLPreInitializationEvent event) { - Logger.INFO("[GT++ ASM] Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); + Preloader_Logger.INFO("Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); // Handle GT++ Config handleConfigFile(event); } @Subscribe + public void init(FMLInitializationEvent evt) { + Preloader_Logger.INFO("Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION); + + } + + @Subscribe public void postInit(FMLPostInitializationEvent evt) { - Logger.INFO("[GT++ ASM] Finished loading GT++ Pre-Loader."); + Preloader_Logger.INFO("Finished loading."); } public static void handleConfigFile(final FMLPreInitializationEvent event) { @@ -84,17 +79,17 @@ public class Preloader_DummyContainer extends DummyModContainer { } public static boolean getConfig(){ - final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg")); + final Configuration config = new Configuration( new File(gtPlusPlus.preloader.CORE_Preloader.MC_DIR, "config/GTplusplus/GTplusplus.cfg")); if (config != null){ config.load(); // Circuits CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times."); CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s."); - Logger.INFO("GT++ Preloader - Loaded the configuration file."); + Preloader_Logger.INFO("Loaded the configuration file."); return true; } - Logger.INFO("GT++ Preloader - Failed loading the configuration file."); + Preloader_Logger.INFO("Failed loading the configuration file."); return false; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java index b208c2f8f0..6eb6070853 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java @@ -1,12 +1,16 @@ package gtPlusPlus.preloader.asm; +import java.io.File; import java.util.Map; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.SortingIndex; - +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; import gtPlusPlus.preloader.asm.transformers.Preloader_Transformer_Handler; +import net.minecraft.launchwrapper.Launch; +import sun.repackage.ForgeEnumHelper; @SortingIndex(10097) @MCVersion(value = "1.7.10") @@ -14,6 +18,10 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { //-Dfml.coreMods.load=gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin + static { + Preloader_Logger.INFO("Initializing IFMLLoadingPlugin"); + } + @Override public String getAccessTransformerClass() { return null; @@ -22,7 +30,9 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { @Override public String[] getASMTransformerClass() { //This will return the name of the class - return new String[]{Preloader_Transformer_Handler.class.getName()}; + return new String[]{ + Preloader_Transformer_Handler.class.getName() + }; } @Override @@ -33,12 +43,34 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { @Override public String getSetupClass() { + //return Preloader_SetupClass.class.getName(); return null; } @Override public void injectData(Map<String, Object> data) { - + boolean isDeObf = (boolean) data.get("runtimeDeobfuscationEnabled"); + File mcDir = (File) data.get("mcLocation"); + //LaunchClassLoader classLoader = (LaunchClassLoader) data.get("classLoader"); + File coremodLocation = (File) data.get("coremodLocation"); + String deobfuscationFileName = (String) data.get("deobfuscationFileName"); + if (mcDir != null && mcDir.exists()) { + CORE_Preloader.setMinecraftDirectory(mcDir); + Preloader_Logger.INFO("Set McDir via Preloader_SetupClass"); + } + Preloader_Logger.INFO("runtimeDeobfuscationEnabled: "+isDeObf); + Preloader_Logger.INFO("deobfuscationFileName: "+deobfuscationFileName); + if (coremodLocation != null && coremodLocation.exists()) { + Preloader_Logger.INFO("coremodLocation: "+coremodLocation.getPath()); + } + else { + Preloader_Logger.INFO("coremodLocation: null"); + Preloader_Logger.ERROR("Unable to determine CoreMod location"); + } + CORE_Preloader.DEV_ENVIRONMENT = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); + CORE_Preloader.DEBUG_MODE = AsmConfig.debugMode; + ForgeEnumHelper.setup(); + Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java new file mode 100644 index 0000000000..a6d2b6c863 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_SetupClass.java @@ -0,0 +1,23 @@ +package gtPlusPlus.preloader.asm; + +import java.io.File; +import java.util.Map; + +import cpw.mods.fml.relauncher.IFMLCallHook; +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.preloader.Preloader_Logger; + +public class Preloader_SetupClass implements IFMLCallHook { + + @Override + public Void call() throws Exception { + Preloader_Logger.INFO("Executing IFMLCallHook"); + return null; + } + + @Override + public void injectData(Map<String, Object> data) { + + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java new file mode 100644 index 0000000000..8120df81fa --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/helpers/MethodHelper_GT.java @@ -0,0 +1,25 @@ +package gtPlusPlus.preloader.asm.helpers; + +import java.util.List; + +import gregtech.api.enums.Materials; +import gregtech.api.items.GT_MetaGenerated_Tool; +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/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java index f71615b7c1..dce1fa15d2 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java @@ -21,7 +21,6 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.SubTag; import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -149,7 +148,7 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity { int mMode; - public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, boolean obfuscated, int aMode) { + public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, int aMode) { mMode = aMode; ClassReader aTempReader = null; ClassWriter aTempWriter = null; diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java index 4394aa0f04..e123c6a9e0 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BusPatch.java @@ -1,6 +1,28 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; +import static org.objectweb.asm.Opcodes.AALOAD; +import static org.objectweb.asm.Opcodes.AASTORE; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACONST_NULL; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ANEWARRAY; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.DUP; +import static org.objectweb.asm.Opcodes.F_FULL; +import static org.objectweb.asm.Opcodes.GOTO; +import static org.objectweb.asm.Opcodes.ICONST_0; +import static org.objectweb.asm.Opcodes.ICONST_1; +import static org.objectweb.asm.Opcodes.ICONST_2; +import static org.objectweb.asm.Opcodes.IF_ICMPLT; +import static org.objectweb.asm.Opcodes.ILOAD; +import static org.objectweb.asm.Opcodes.INTEGER; +import static org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static org.objectweb.asm.Opcodes.NEW; +import static org.objectweb.asm.Opcodes.PUTFIELD; +import static org.objectweb.asm.Opcodes.RETURN; +import static org.objectweb.asm.Opcodes.UNINITIALIZED_THIS; import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassReader; @@ -10,13 +32,14 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.preloader.asm.ClassesToTransform; public class ClassTransformer_GT_BusPatch { - public static final String aSuperInput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input"; - public static final String aSuperOutput = "gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output"; - public static final String aInput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus"; - public static final String aOutput = "gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus"; + private static final String aSuperInputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS.replace(".", "/"); + private static final String aSuperOutputFormatted = ClassesToTransform.GTPP_MTE_HATCH_SUPER_OUTPUT_BUS.replace(".", "/"); + private static final String aInputFormatted = ClassesToTransform.GT_MTE_HATCH_INPUTBUS.replace(".", "/"); + private static final String aOutputFormatted = ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS.replace(".", "/"); private final boolean isValid; private final ClassReader reader; @@ -74,7 +97,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_Hatch_InputBus //Constructor - if (aClassName.equals(aInput)){ + if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_INPUTBUS)){ //Constructor 1 { @@ -131,14 +154,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l4); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l5 = new Label(); mv.visitLabel(l5); mv.visitLineNumber(21, l5); mv.visitInsn(RETURN); Label l6 = new Label(); mv.visitLabel(l6); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l6, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l6, 0); mv.visitLocalVariable("aID", "I", null, l0, l6, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l6, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l6, 3); @@ -168,14 +191,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(30, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3); @@ -205,14 +228,14 @@ public class ClassTransformer_GT_BusPatch { mv.visitLineNumber(16, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(34, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l3, 3); @@ -231,7 +254,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_Hatch_OutputBus //Constructor - if (aClassName.equals(aOutput)){ + if (aClassName.equals(ClassesToTransform.GT_MTE_HATCH_OUTPUTBUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -288,7 +311,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l5 = new Label(); mv.visitLabel(l5); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l5, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l5, 0); mv.visitLocalVariable("aID", "I", null, l0, l5, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l5, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l5, 3); @@ -317,7 +340,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l2 = new Label(); mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1); mv.visitLocalVariable("aTier", "I", null, l0, l2, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3); @@ -346,7 +369,7 @@ public class ClassTransformer_GT_BusPatch { mv.visitInsn(RETURN); Label l2 = new Label(); mv.visitLabel(l2); - mv.visitLocalVariable("this", "Lgregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus;", null, l0, l2, 0); + mv.visitLocalVariable("this", "L"+aOutputFormatted+";", null, l0, l2, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l2, 1); mv.visitLocalVariable("aTier", "I", null, l0, l2, 2); mv.visitLocalVariable("aSlots", "I", null, l0, l2, 3); @@ -363,7 +386,7 @@ public class ClassTransformer_GT_BusPatch { //GT_MetaTileEntity_SuperBus_Input //Constructor - if (aClassName.equals(aSuperInput)){ + if (aClassName.equals(ClassesToTransform.GTPP_MTE_HATCH_SUPER_INPUT_BUS)){ { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(ILjava/lang/String;Ljava/lang/String;II)V", null, null); @@ -376,20 +399,20 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(ILjava/lang/String;Ljava/lang/String;I)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(28, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aID", "I", null, l0, l3, 1); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 2); mv.visitLocalVariable("aNameRegional", "Ljava/lang/String;", null, l0, l3, 3); @@ -409,23 +432,23 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(28, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv.visitLocalVariable("aName", "Ljava/lang/String;", null, l0, l3, 1); mv.visitLocalVariable("aTier", "I", null, l0, l3, 2); mv.visitLocalVariable("aDescription", "Ljava/lang/String;", null, l0, l3, 3); @@ -444,25 +467,25 @@ public class ClassTransformer_GT_BusPatch { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "getSlots", "(I)I", false); + mv.visitMethodInsn(INVOKESTATIC, ""+aSuperInputFormatted+"", "getSlots", "(I)I", false); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitInsn(AALOAD); mv.visitVarInsn(ALOAD, 4); - mv.visitMethodInsn(INVOKESPECIAL, "gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); + mv.visitMethodInsn(INVOKESPECIAL, ""+aInputFormatted+"", "<init>", "(Ljava/lang/String;IILjava/lang/String;[[[Lgregtech/api/interfaces/ITexture;)V", false); Label l1 = new Label(); mv.visitLabel(l1); mv.visitLineNumber(20, l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ACONST_NULL); - mv.visitFieldInsn(PUTFIELD, "gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); + mv.visitFieldInsn(PUTFIELD, ""+aSuperInputFormatted+"", "mRecipeMap", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;"); Label l2 = new Label(); mv.visitLabel(l2); mv.visitLineNumber(32, l2); mv.visitInsn(RETURN); Label l3 = new Label(); mv.visitLabel(l3); - mv.visitLocalVariable("this", "LgtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input;", null, l0, l3, 0); + mv.visitLocalVariable("this", "L"+aSuperInputFormatted+";", null, l0, l3, 0); mv. |
