import crafttweaker.api.GenericRecipesManager;
import crafttweaker.api.recipe.type.Recipe;
import crafttweaker.api.item.IItemStack;
import mods.jeitweaker.Jei;
import crafttweaker.api.ingredient.IIngredient;
import crafttweaker.api.world.Container;
import crafttweaker.api.recipe.replacement.Replacer;

print("Running crafttweaker script zaperoxcraft");
//recipes.removeByModid("mekanism");
//recipes.removeByModid("create_new_age");
//recipes.removeByModid("bigreactors");

//remove mekanism and hide (for now)
for itemStack in loadedMods.getMod("mekanism").getItemStacks() {
	recipes.remove(itemStack);
}
Jei.hideModIngredients("mekanism");

//remove create_new_age and hide (for now)
for itemStack in loadedMods.getMod("create_new_age").getItemStacks() {
	recipes.remove(itemStack);
}
Jei.hideModIngredients("create_new_age");

//remove bigreactors and hide (for now)
for itemStack in loadedMods.getMod("bigreactors").getItemStacks() {
	recipes.remove(itemStack);
}
Jei.hideModIngredients("bigreactors");

//remove modular force field and hide (for now)
for itemStack in loadedMods.getMod("mffs").getItemStacks() {
	recipes.remove(itemStack);
}
Jei.hideModIngredients("mffs");

//remove ad_astra and hide (for now)
for itemStack in loadedMods.getMod("ad_astra").getItemStacks() {
	recipes.remove(itemStack);
}
Jei.hideModIngredients("ad_astra");

//start up the replacer
var newReplacer = Replacer.create();

//create our own garlic tag
<tag:items:crafttweaker:garlic>.add(<item:veggiesdelight:garlic>);
<tag:items:crafttweaker:garlic>.add(<item:spanishdelight:garlic>);
//replace garlic recipe garlics with our new group
newReplacer.replace<IIngredient>(<recipecomponent:crafttweaker:input/ingredients>, <item:veggiesdelight:garlic>, <tag:items:crafttweaker:garlic>);
newReplacer.replace<IIngredient>(<recipecomponent:crafttweaker:input/ingredients>, <item:spanishdelight:garlic>, <tag:items:crafttweaker:garlic>);

//create our own bellpepper tag
<tag:items:crafttweaker:bellpepper>.add(<item:spanishdelight:green_pepper>);
<tag:items:crafttweaker:bellpepper>.add(<item:spanishdelight:red_pepper>);
<tag:items:crafttweaker:bellpepper>.add(<item:veggiesdelight:bellpepper>);
//replace bellpepper recipes bellpeppers with our new group
newReplacer.replace<IIngredient>(<recipecomponent:crafttweaker:input/ingredients>, <item:spanishdelight:green_pepper>, <tag:items:crafttweaker:bellpepper>);
newReplacer.replace<IIngredient>(<recipecomponent:crafttweaker:input/ingredients>, <item:spanishdelight:red_pepper>, <tag:items:crafttweaker:bellpepper>);
newReplacer.replace<IIngredient>(<recipecomponent:crafttweaker:input/ingredients>, <item:veggiesdelight:bellpepper>, <tag:items:crafttweaker:bellpepper>);

//add SD peppers to vegetables
<tag:items:forge:vegetables>.add(<item:spanishdelight:green_pepper>);
<tag:items:forge:vegetables>.add(<item:spanishdelight:red_pepper>);

newReplacer.execute();

//for sigularRecipe in recipes.getAllRecipes() as stdlib.List<Recipe<Container>> {
//	for ingredient in sigularRecipe.ingredients {
//		if(ingredient == <item:spanishdelight:garlic>){
//			print(ingredient.commandString); // This will print each ingredient as IItemStack
//			//ingredient = <item:veggiesdelight:garlic>;
//		}
//    }
//}