// Path: src/main/java/tppitweaks/TPPITweaks.java
// @Mod(modid = "TPPITweaks", name = "TPPI Tweaks", version = TPPITweaks.VERSION, dependencies = Reference.DEPENDENCIES)
// public class TPPITweaks
// {
// 	public static final String VERSION = "@VERSION@";
// 
// 	@Instance("TPPITweaks")
// 	public static TPPITweaks instance;
// 
// 	@SidedProxy(clientSide = "tppitweaks.proxy.ClientProxy", serverSide = "tppitweaks.proxy.CommonProxy")
// 	public static CommonProxy proxy;
// 
// 	public static TPPIEventHandler eventHandler;
// 
// 	public static final Logger logger = LogManager.getLogger("TPPITweaks");
// 
// 	public static CreativeTabTPPI creativeTab = new CreativeTabTPPI(CreativeTabs.getNextID());
// 
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event)
// 	{		
// 		RecipeTweakingCore.registerPackageName("tppitweaks.tweak.recipe");
// 
// 		ConfigurationHandler.init(new File(event.getModConfigurationDirectory().getAbsolutePath() + "/TPPI/TPPITweaks.cfg"));
// 	}
// 
// 	@EventHandler
// 	public void init(FMLInitializationEvent event)
// 	{
// 		// AM2SpawnControls.doAM2SpawnControls();
// 
// 		ModItems.initItems();
// 		ModBlocks.initBlocks();
// 		
// 		eventHandler = new TPPIEventHandler();
// 		MinecraftForge.EVENT_BUS.register(eventHandler);
// 		ModItems.registerRecipes();
// 		ModBlocks.registerRecipes();
// 
// 		if (event.getSide().isClient())
// 			proxy.initTickHandler();
// 		
// 		if (Loader.isModLoaded("Thaumcraft"))
// 			TweakVanilla.init();
// 	}
// 
// 	@EventHandler
// 	public void postInit(FMLPostInitializationEvent event)
// 	{
// 		AdditionalTweaks.doOreDictTweaks();
// 		AdditionalTweaks.addMiscRecipes();
// 	}
// 
// 	@EventHandler
// 	public void onFMLServerStart(FMLServerStartingEvent event)
// 	{
// 		event.registerServerCommand(new CommandOres());
// 		event.registerServerCommand(new CommandGetInvolved());
// 	}
// }
// 
// Path: src/main/java/tppitweaks/lib/Reference.java
// public class Reference {
// 	public static final String CHANNEL = "tppitweaks";
// 	public static final String TAB_NAME = "tabTPPI";
// 	
// 	public static File modsFolder;
// 	
// 	public static final String DEPENDENCIES = 
// 			"before:ThaumicTinkerer;"
// 			+ "after:Thaumcraft;"
// 			+ "after:TwilightForest;"
// 			+ "after:AppliedEnergistics;"
// 			+ "after:StevesFactoryManager;"
// 			+ "after:DimensionalAnchors;"
// 			+ "after:ThermalExpansion;"
// 			+ "after:ExtraUtilities;"
// 			+ "after:EnderStorage;"
// 			+ "after:BigReactors;"
// 			+ "after:BuildCraft|Core;"
// 			+ "after:Mekanism;"
// 			+ "after:xreliquary;"
// 			+ "after:NotEnoughItems;"
// 			+ "after:Railcraft;"
// 			+ "after:IC2;"
// 			+ "after:MineFactoryReloaded;"
// 			+ "after:JABBA;"
// 			+ "after:EnderIO;"
// 			+ "required-after:recipetweakingcore";
// 	
// 	public static String packName = "Test Pack Please Ignore";
// 	public static String packVersion = "0.2.2";
// 	public static String packAcronym = "TPPI";
// }


import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import tppitweaks.TPPITweaks;
import tppitweaks.lib.Reference;

    public static boolean enableMod(String partOfName, String extensionToRemove)
    {
        boolean hasChanged = false;
        for (File f : getMods(partOfName))
        {
            TPPITweaks.logger.info("Enabling: " + f.getName());
            if (f.getName().contains(extensionToRemove))
            {
                f.renameTo(new File(f.getAbsolutePath().replace(extensionToRemove, "")));
                hasChanged = true;
            }
            else
            {
                TPPITweaks.logger.info(partOfName + " was already enabled!");
            }
        }
        return hasChanged;
    }

    /**
     * Finds all mods that contain the passed string in their filename that exist in the /mods folder
     * 
     * @return A list of Files that are mod jars (or zips)
     */
    public static ArrayList<File> getMods(String partOfName)
    {
        ArrayList<File> files = new ArrayList<File>();
        File mods;

// Path: src/main/java/tppitweaks/TPPITweaks.java
// @Mod(modid = "TPPITweaks", name = "TPPI Tweaks", version = TPPITweaks.VERSION, dependencies = Reference.DEPENDENCIES)
// public class TPPITweaks
// {
// 	public static final String VERSION = "@VERSION@";
// 
// 	@Instance("TPPITweaks")
// 	public static TPPITweaks instance;
// 
// 	@SidedProxy(clientSide = "tppitweaks.proxy.ClientProxy", serverSide = "tppitweaks.proxy.CommonProxy")
// 	public static CommonProxy proxy;
// 
// 	public static TPPIEventHandler eventHandler;
// 
// 	public static final Logger logger = LogManager.getLogger("TPPITweaks");
// 
// 	public static CreativeTabTPPI creativeTab = new CreativeTabTPPI(CreativeTabs.getNextID());
// 
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent event)
// 	{		
// 		RecipeTweakingCore.registerPackageName("tppitweaks.tweak.recipe");
// 
// 		ConfigurationHandler.init(new File(event.getModConfigurationDirectory().getAbsolutePath() + "/TPPI/TPPITweaks.cfg"));
// 	}
// 
// 	@EventHandler
// 	public void init(FMLInitializationEvent event)
// 	{
// 		// AM2SpawnControls.doAM2SpawnControls();
// 
// 		ModItems.initItems();
// 		ModBlocks.initBlocks();
// 		
// 		eventHandler = new TPPIEventHandler();
// 		MinecraftForge.EVENT_BUS.register(eventHandler);
// 		ModItems.registerRecipes();
// 		ModBlocks.registerRecipes();
// 
// 		if (event.getSide().isClient())
// 			proxy.initTickHandler();
// 		
// 		if (Loader.isModLoaded("Thaumcraft"))
// 			TweakVanilla.init();
// 	}
// 
// 	@EventHandler
// 	public void postInit(FMLPostInitializationEvent event)
// 	{
// 		AdditionalTweaks.doOreDictTweaks();
// 		AdditionalTweaks.addMiscRecipes();
// 	}
// 
// 	@EventHandler
// 	public void onFMLServerStart(FMLServerStartingEvent event)
// 	{
// 		event.registerServerCommand(new CommandOres());
// 		event.registerServerCommand(new CommandGetInvolved());
// 	}
// }
// 
// Path: src/main/java/tppitweaks/lib/Reference.java
// public class Reference {
// 	public static final String CHANNEL = "tppitweaks";
// 	public static final String TAB_NAME = "tabTPPI";
// 	
// 	public static File modsFolder;
// 	
// 	public static final String DEPENDENCIES = 
// 			"before:ThaumicTinkerer;"
// 			+ "after:Thaumcraft;"
// 			+ "after:TwilightForest;"
// 			+ "after:AppliedEnergistics;"
// 			+ "after:StevesFactoryManager;"
// 			+ "after:DimensionalAnchors;"
// 			+ "after:ThermalExpansion;"
// 			+ "after:ExtraUtilities;"
// 			+ "after:EnderStorage;"
// 			+ "after:BigReactors;"
// 			+ "after:BuildCraft|Core;"
// 			+ "after:Mekanism;"
// 			+ "after:xreliquary;"
// 			+ "after:NotEnoughItems;"
// 			+ "after:Railcraft;"
// 			+ "after:IC2;"
// 			+ "after:MineFactoryReloaded;"
// 			+ "after:JABBA;"
// 			+ "after:EnderIO;"
// 			+ "required-after:recipetweakingcore";
// 	
// 	public static String packName = "Test Pack Please Ignore";
// 	public static String packVersion = "0.2.2";
// 	public static String packAcronym = "TPPI";
// }


// Path: src/main/java/tppitweaks/util/TPPITweaksUtils.java
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import tppitweaks.TPPITweaks;
import tppitweaks.lib.Reference;


    public static boolean enableMod(String partOfName, String extensionToRemove)
    {
        boolean hasChanged = false;
        for (File f : getMods(partOfName))
        {
            TPPITweaks.logger.info("Enabling: " + f.getName());
            if (f.getName().contains(extensionToRemove))
            {
                f.renameTo(new File(f.getAbsolutePath().replace(extensionToRemove, "")));
                hasChanged = true;
            }
            else
            {
                TPPITweaks.logger.info(partOfName + " was already enabled!");
            }
        }
        return hasChanged;
    }

    /**
     * Finds all mods that contain the passed string in their filename that exist in the /mods folder
     * 
     * @return A list of Files that are mod jars (or zips)
     */
    public static ArrayList<File> getMods(String partOfName)
    {
        ArrayList<File> files = new ArrayList<File>();
        File mods;

        mods = Reference.modsFolder;