/* Set up Imports */
import crafttweaker.api.events.CTEventManager;
import crafttweaker.api.event.entity.player.MCPlayerLoggedInEvent; 

/* Set values and variables */
val air = <item:minecraft:air>;

/*Set recipe stage to allow crafting in refined storage and rf tools*/
mods.recipestages.Recipes.setPrintContainers(true);
mods.recipestages.Recipes.setContainerStages("com.refinedmods.refinedstorage.apiimpl.network.node.GridNetworkNode$1", ["Tinkerer", "AdvancedTinkering", "Mechanic", "Magitech", "NoviceMagic", "Mage", "Wizard"]);
mods.recipestages.Recipes.setContainerStages("mcjty.rftoolsutility.modules.crafter.blocks.CrafterBaseTE$1", ["Tinkerer", "AdvancedTinkering", "Mechanic", "Magitech", "NoviceMagic", "Mage", "Wizard"]);
mods.recipestages.Recipes.setContainerStages("com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingPattern$DummyCraftingInventory$1", ["Tinkerer", "AdvancedTinkering", "Mechanic", "Magitech", "NoviceMagic", "Mage", "Wizard"]);
mods.recipestages.Recipes.setContainerStages("com.refinedmods.refinedstorageaddons.item.WirelessCraftingGrid$1", ["Tinkerer", "AdvancedTinkering", "Mechanic", "Magitech", "NoviceMagic", "Mage", "Wizard"]);
mods.recipestages.Recipes.setContainerStages("com.jaquadro.minecraft.storagedrawers.util.CompactingHelper$InventoryLookup@218759a", ["Tinkerer", "AdvancedTinkering", "Mechanic", "Magitech", "NoviceMagic", "Mage", "Wizard"]);

/* Stages by mod. This allows staging of all of a specific mod's items */
	/* Stage Tech Tier One */
mods.recipestages.Recipes.setRecipeStageByMod("Tinkerer", "create");
mods.recipestages.Recipes.setRecipeStageByMod("Tinkerer", "tetra");
mods.recipestages.Recipes.setRecipeStageByMod("Tinkerer", "enderstorage");
mods.recipestages.Recipes.setRecipeStageByMod("Tinkerer", "tmechworks");
mods.recipestages.Recipes.setRecipeStageByMod("Tinkerer", "pocketstorage");
	
	/* Stage Tech Tier Two */
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "pneumaticcraft");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "refinedpipes");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "rftoolsbase");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "rftoolsbuilder");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "rftoolsstorage");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "rftoolsutility");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "rftoolspower");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "darkutils");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "rangedpumps");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "solarflux");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "immersiveengineering");
mods.recipestages.Recipes.setRecipeStageByMod("AdvancedTinkering", "immersivepetroleum");
	
	/* Stage Tech Tier Three */
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "bigreactors");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "thermal");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "refinedstorage");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "rsrequestify");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "envirocore");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "envirotech");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "integrateddynamics");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "integratedtunnels");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "boss_tools");
mods.recipestages.Recipes.setRecipeStageByMod("Mechanic", "xnet");
	
	/* Stage Tech Tier Four */
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "woot");
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "industrialforegoing");
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "mekanism");
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "mekanismadditions");
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "mekanismgenerators");
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "mekanismtools");
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "compactmachines");
mods.recipestages.Recipes.setRecipeStageByMod("Magitech", "quantumquarryplus");

	/* Stage Magic Tier One */
mods.recipestages.Recipes.setRecipeStageByMod("NoviceMagic", "mysticalagriculture");
mods.recipestages.Recipes.setRecipeStageByMod("NoviceMagic", "eidolon");
mods.recipestages.Recipes.setRecipeStageByMod("NoviceMagic", "astralsorcery");
mods.recipestages.Recipes.setRecipeStageByMod("NoviceMagic", "tombstone");
	
	/* Stage Magic Tier Two */
mods.recipestages.Recipes.setRecipeStageByMod("Mage", "naturesaura");
mods.recipestages.Recipes.setRecipeStageByMod("Mage", "bloodmagic");
mods.recipestages.Recipes.setRecipeStageByMod("Mage", "angelring");
mods.recipestages.Recipes.setRecipeStageByMod("Mage", "xreliquary");
	
	/* Stage Magic Tier Three */
mods.recipestages.Recipes.setRecipeStageByMod("Wizard", "botania");
mods.recipestages.Recipes.setRecipeStageByMod("Wizard", "mana-and-artifice");
mods.recipestages.Recipes.setRecipeStageByMod("Wizard", "aiotbotania");
	
/* Stages by item. Allows for more acurate gamestages. Added after mods to allow for certain mods to have certain items stages differently. */
	/* Stage Start */
var CArray = [
	<item:tombstone:decorative_grave_simple>,
	<item:tombstone:decorative_grave_normal>,
	<item:tombstone:decorative_grave_cross>,
	<item:tombstone:decorative_tombstone>,
	<item:tombstone:decorative_subaraki_grave>,
	<item:tombstone:decorative_grave_original>,
	<item:thermal:coal_coke>,
	<item:thermal:constantan_nugget>,
	<item:thermal:signalum_nugget>,
	<item:thermal:lumium_nugget>,
	<item:botania:manasteel_nugget>,
	<item:botania:terrasteel_nugget>,
	<item:botania:elementium_nugget>,
	<item:thermal:enderium_nugget>,
	<item:tmechworks:copper_nugget>,
	<item:eidolon:lead_nugget>,
	<item:mekanism:nugget_uranium>,
	<item:thermal:copper_nugget>,
	<item:thermal:tin_nugget>,
	<item:thermal:lead_nugget>,
	<item:thermal:silver_nugget>,
	<item:thermal:nickel_nugget>,
	<item:thermal:bronze_nugget>,
	<item:thermal:electrum_nugget>,
	<item:thermal:invar_nugget>,
	<item:immersiveengineering:nugget_steel>,
	<item:mekanism:nugget_refined_obsidian>,
	<item:mekanism:nugget_bronze>,
	<item:mekanism:nugget_refined_glowstone>,
	<item:mekanism:nugget_steel>,
	<item:mekanism:nugget_osmium>,
	<item:mekanism:nugget_copper>,
	<item:mekanism:nugget_tin>,
	<item:mekanism:nugget_lead>,
	<item:immersiveengineering:nugget_copper>,
	<item:immersiveengineering:nugget_aluminum>,
	<item:immersiveengineering:nugget_lead>,
	<item:immersiveengineering:nugget_silver>,
	<item:immersiveengineering:nugget_nickel>,
	<item:tmechworks:aluminum_nugget>,
	<item:immersiveengineering:nugget_uranium>,
	<item:immersiveengineering:nugget_constantan>,
	<item:immersiveengineering:nugget_electrum>,
	<item:eidolon:pewter_nugget>,
	<item:eidolon:arcane_gold_nugget>,
	<item:iceandfire:silver_nugget>,
	<item:iceandfire:copper_nugget>,
	<item:mysticalagriculture:prosperity_nugget>,
	<item:mysticalagriculture:inferium_nugget>,
	<item:mysticalagriculture:prudentium_nugget>,
	<item:mysticalagriculture:tertium_nugget>,
	<item:mysticalagriculture:imperium_nugget>,
	<item:mysticalagriculture:supremium_nugget>,
	<item:mysticalagriculture:soulium_nugget>,
	<item:immersiveengineering:storage_steel>,
	<item:thermal:copper_block>,
	<item:thermal:tin_block>,
	<item:thermal:lead_block>,
	<item:immersiveengineering:storage_aluminum>,
	<item:thermal:silver_block>,
	<item:immersiveengineering:nugget_aluminum>,
	<item:immersiveengineering:nugget_steel>,
	<item:thermal:copper_nugget>,
	<item:thermal:tin_nugget>,
	<item:thermal:lead_nugget>,
	<item:thermal:silver_nugget>,
	<item:thermal:bronze_nugget>,
	<item:thermal:electrum_nugget>,
	<item:thermal:constantan_nugget>,
	<item:immersiveengineering:ingot_steel>,
	<item:thermal:copper_ingot>,
	<item:immersiveengineering:ingot_aluminum>,
	<item:thermal:tin_ingot>,
	<item:thermal:lead_ingot>,
	<item:thermal:silver_ingot>,
	<item:thermal:bronze_ingot>,
	<item:thermal:electrum_ingot>,
	<item:thermal:constantan_ingot>,
	<item:thermal:nickel_ingot>,
	<item:mekanism:block_lead>,
	<item:mekanism:block_steel>,
	<item:mekanism:block_osmium>
];

/* Clear recipe stages to retier*/
for item in CArray{
	mods.recipestages.Recipes.clearRecipeStage(item);
}

	/* Stage Tech Tier One */
/* Change create recipe to use chains for chaindrive instead of nuggets */
mods.recipestages.Recipes.addShaped("Tinkerer", "thb_chains_for_chaindrive", <item:create:encased_chain_drive>,[
	[air, <item:minecraft:chain>, air],
	[<item:create:shaft>, <item:create:andesite_casing>, <item:create:shaft>],
	[air, <item:minecraft:chain>, air]
]);
	/* Stage Tech Tier Two */
	
	/* Stage Tech Tier Three */
	
	/* Stage Tech Tier Four */
	
	/* Stage Magic Tier One */
	
	/* Stage Magic Tier Two */
	
	/* Stage Magic Tier Three */