onEvent('recipes', event => {
	
	event.remove({id: /immersiveengineering:cloche\/\w+/});
	event.remove({id: /farmersdelight:integration\/immersiveengineering\/cloche\/\w+/});
	event.remove({id: /corn_delight:integration\/immersiveengineering\/cloche\/\w+/});
	
	// recipes
	
	singleR(`minecraft:bamboo`, 1, `minecraft:bamboo`, `minecraft:bamboo`)
	singleR(`minecraft:melon_seeds`, 1, `minecraft:melon`, `minecraft:melon`)
	singleR(`minecraft:sweet_berries`, 1, `minecraft:sweet_berries`, `minecraft:sweet_berry_bush`)
	singleR(`minecraft:pumpkin`, 1, `minecraft:pumpkin_seeds`, `minecraft:pumpkin`)
	singleR(`minecraft:carrot`, 2, `minecraft:carrot`, `minecraft:carrots`)
	singleR(`minecraft:potato`, 2, `minecraft:potato`, `minecraft:potatoes`)
	singleR(`farmersdelight:rice_panicle`, 2, `farmersdelight:rice`, `farmersdelight:rice`)
	singleR(`farmersdelight:onion`, 2, `farmersdelight:onion`, `farmersdelight:onion`)
	singleR(`farmersdelight:tomato`, 2, `farmersdelight:tomato_seeds`, `farmersdelight:budding_tomatoes`)
	singleR(`corn_delight:corn`, 2, `corn_delight:corn_seeds`, `corn_delight:corn_crop`)
	singleR(`alcocraft:hop`, 2, `alcocraft:hop_seeds`, `alcocraft:hop_block`)
	
	doubleR(`farmersrespite:black_tea_leaves`, 1,`farmersrespite:yellow_tea_leaves`, 1, `farmersrespite:tea_seeds`, `farmersrespite:small_tea_bush`)
	doubleR(`minecraft:beetroot`, 1, `minecraft:beetroot_seeds`, 1, `minecraft:beetroot_seeds`, `minecraft:beetroots`)
	doubleR(`supplementaries:flax`, 2, `supplementaries:flax_seeds`, 1, `supplementaries:flax_seeds`, `supplementaries:flax`)
	doubleR(`minecraft:wheat`, 2, `minecraft:wheat_seeds`, 1, `minecraft:wheat_seeds`, `minecraft:wheat`)
	doubleR(`farmersdelight:cabbage`, 2, `farmersdelight:cabbage_seeds`, 1, `farmersdelight:cabbage_seeds`, `farmersdelight:cabbages`)
	doubleR(`immersiveengineering:hemp_fiber`, 1, `immersiveengineering:seed`, 2, `immersiveengineering:seed`, `minecraft:wheat`)
	
	//custom soil
	singleSoil(`minecraft:glow_berries`, 2, `minecraft:glow_berries`, `minecraft:cave_vines`, `minecraft:moss_block`)
	singleSoil(`minecraft:red_mushroom`, 1, `minecraft:red_mushroom`, `minecraft:wheat`, `minecraft:podzol`)
	singleSoil(`minecraft:red_mushroom`, 2, `minecraft:red_mushroom`, `minecraft:wheat`, `minecraft:mycelium`)
	singleSoil(`minecraft:brown_mushroom`, 1, `minecraft:brown_mushroom`, `minecraft:wheat`, `minecraft:podzol`)
	singleSoil(`minecraft:brown_mushroom`, 2, `minecraft:brown_mushroom`, `minecraft:wheat`, `minecraft:mycelium`)
	
	singleSoil(`minecraft:cactus`, 1, `minecraft:cactus`, `minecraft:cactus`, `#forge:sand`)
	singleSoil(`minecraft:sugar_cane`, 1, `minecraft:sugar_cane`, `minecraft:sugar_cane`, `#forge:sand`)
	
	singleSoil(`minecraft:chorus_fruit`, 1, `minecraft:chorus_flower`, `minecraft:chorus_flower`, `minecraft:end_stone`)
	singleSoil(`minecraft:nether_wart`, 2, `minecraft:nether_wart`, `minecraft:nether_wart`, `minecraft:soul_sand`)
	singleSoil(`farmersrespite:coffee_berries`, 1, `farmersrespite:coffee_beans`, `minecraft:wheat`, 'minecraft:magma_block')
	singleSoil(`undergarden:gloomgourd`, 1, `undergarden:gloomgourd_seeds`, `undergarden:gloomgourd_stem`, 'minecraft:wheat')
	
	
	// functions
	
	function singleR(output, amount, seed, crop) {
		cloche(output, amount, seed, 'minecraft:dirt', crop, 300);
	}
	
	function doubleR(output1, amount1, output2, amount2, seed, crop) {
		clocheDouble(output1, amount1, output2, amount2, seed, 'minecraft:dirt', crop, 300);
	}
	
	function doubleSoil(output1, amount1, output2, amount2, seed, crop, soil) {
		clocheDouble(output1, amount1, output2, amount2, seed, soil, crop, 300);
	}
	
	function singleSoil(output, amount, seed, crop, soil) {
		cloche(output, amount, seed, soil, crop, 300);
	}
	
	function cloche(output, amount, seed, soil, render, time) {
		event.custom({
			type: "immersiveengineering:cloche",
			results: [
				{
					item: output,
					count: amount
				}
			],
			input: Ingredient.of(seed),
			soil: Ingredient.of(soil),
			time: time,
			render: {
				type: "crop",
				block: render
			}
		}).id(`kubejs:cloche/${seed.replace(':', '/')}`)
	}
	
	function clocheDouble(output1, amount1, output2, amount2, seed, soil, render, time) {
		event.custom({
			type: "immersiveengineering:cloche",
			results: [
				{
					item: output1,
					count: amount1
				},
				{
					item: output2,
					count: amount2
				}
			],
			input: Ingredient.of(seed),
			soil: Ingredient.of(soil),
			time: time,
			render: {
				type: "crop",
				block: render
			}
		}).id(`kubejs:cloche/${seed.replace(':', '/')}`)
	}
})

