import static gregtech.api.GTValues.*
import gregtech.api.metatileentity.multiblock.CleanroomType

//////////////
// Removals //
//////////////

//Good Luck here, AE2 recipes that are removed in no particular order.
mods.jei.yeet(item('appliedenergistics2:part', 15))
mods.jei.yeet(item('appliedenergistics2:part', 14))
mods.jei.yeet(item('appliedenergistics2:part', 13))
mods.jei.yeet(item('appliedenergistics2:part', 12))
mods.jei.yeet(item('appliedenergistics2:part', 11))
mods.jei.yeet(item('appliedenergistics2:part', 10))
mods.jei.yeet(item('appliedenergistics2:part', 9))
mods.jei.yeet(item('appliedenergistics2:part', 8))
mods.jei.yeet(item('appliedenergistics2:part', 7))
mods.jei.yeet(item('appliedenergistics2:part', 6))
mods.jei.yeet(item('appliedenergistics2:part', 5))
mods.jei.yeet(item('appliedenergistics2:part', 4))
mods.jei.yeet(item('appliedenergistics2:part', 3))
mods.jei.yeet(item('appliedenergistics2:part', 2))
mods.jei.yeet(item('appliedenergistics2:part', 1))
mods.jei.yeet(item('appliedenergistics2:part', 0))
mods.jei.removeAndHide(item('appliedenergistics2:part', 16))
mods.jei.removeAndHide(item('appliedenergistics2:crank'))
mods.jei.removeAndHide(item('appliedenergistics2:grindstone'))
mods.jei.removeAndHide(item('appliedenergistics2:sky_compass'))
mods.jei.removeAndHide(item('appliedenergistics2:vibration_chamber'))           
mods.jei.removeAndHide(item('appliedenergistics2:charger'))
mods.jei.removeAndHide(item('appliedenergistics2:inscriber'))
mods.jei.removeAndHide(item('appliedenergistics2:material', 19))
mods.jei.removeAndHide(item('appliedenergistics2:material', 13))
mods.jei.removeAndHide(item('appliedenergistics2:material', 14))
mods.jei.removeAndHide(item('appliedenergistics2:material', 15))
crafting.removeByOutput(item('appliedenergistics2:interface'))
crafting.removeByOutput(item('appliedenergistics2:fluid_interface'))
crafting.removeByOutput(item('appliedenergistics2:part', 180))
crafting.removeByOutput(item('appliedenergistics2:part', 160))
crafting.removeByOutput(item('appliedenergistics2:part', 200))
crafting.removeByOutput(item('appliedenergistics2:molecular_assembler'))
mods.jei.yeet(item('aeadditions:pattern.fluid'))
mods.jei.yeet(item('aeadditions:terminal.fluid.wireless'))
crafting.removeByOutput(item('appliedenergistics2:chest'))
crafting.removeByOutput(item('appliedenergistics2:condenser'))
crafting.removeByOutput(item('aeadditions:fluidcrafter'))
crafting.removeByOutput(item('aeadditions:fluidfiller'))
crafting.removeByOutput(item('appliedenergistics2:part', 522))
crafting.removeByOutput(item('appliedenergistics2:part', 521))
crafting.removeByOutput(item('appliedenergistics2:part', 480))
//REMOVAL of Base Processing Cores, Recipes Will be added Below, Items missing Recipes will be shifted to use MV/HV/EV Circuits Depending on Recipe.
crafting.removeByInput(item('appliedenergistics2:material', 23)) 
crafting.removeByInput(item('appliedenergistics2:material', 24)) 
crafting.removeByInput(item('appliedenergistics2:material', 22)) 
mods.jei.yeet(item('appliedenergistics2:quartz_growth_accelerator'))
//Import / Export Busses - ONLY ENABLE RECIPES IF YOU ACCEPT THE TPS LAG RISKS - TODO add tooltips
crafting.removeByOutput(item('appliedenergistics2:part', 260))
crafting.removeByOutput(item('appliedenergistics2:part', 240))
crafting.removeByOutput(item('appliedenergistics2:part', 241))
crafting.removeByOutput(item('appliedenergistics2:part', 261))
crafting.removeByOutput(item('appliedenergistics2:material', 52))
//Desolation
mods.jei.yeet(item('appliedenergistics2:part', 261))
mods.jei.yeet(item('aeadditions:part.base', 2))
mods.jei.yeet(item('aeadditions:fluidcrafter'))
mods.jei.yeet(item('aeadditions:vibrantchamberfluid'))
mods.jei.yeet(item('aeadditions:terminal.universal.wireless'))
mods.jei.yeet(item('aeadditions:part.base', 3))

////////////////////////
// Shapeless Crafting //
////////////////////////


//Flat Interface to THICK interface Return Recipes
crafting.addShapeless('convertinterface',item('appliedenergistics2:interface') ,[item('appliedenergistics2:part', 440)])
crafting.addShapeless('convertfluidinterface',item('appliedenergistics2:fluid_interface'), [item('appliedenergistics2:part', 441)])
//Illuminated Panel Shapeless
crafting.addShapeless('illuminatepaneldarktoneutral',item('appliedenergistics2:part', 200) ,[item('appliedenergistics2:part', 180)])
crafting.addShapeless('illuminatepanelneutraltobright',item('appliedenergistics2:part', 180) ,[item('appliedenergistics2:part', 160)])
crafting.addShapeless('illuminatepanelbrighttodark',item('appliedenergistics2:part', 160) ,[item('appliedenergistics2:part', 200)])
//Terminals
crafting.addShapeless('aecraftingterminal',item('appliedenergistics2:part', 360) ,[item('minecraft:crafting_table'),item('tjcore:advanced_logistics_core'),item('appliedenergistics2:part', 380)])
crafting.addShapeless('ae_fluid_terminal_tj',item('appliedenergistics2:part', 520) ,[item('gregtech:machine', 1614),item('tjcore:advanced_logistics_core'),item('appliedenergistics2:part', 380)])
crafting.addShapeless('ae_fluid_config_term_tj',item('appliedenergistics2:part', 522) ,[item('appliedenergistics2:part', 520),item('tjcore:advanced_logistics_core')])
crafting.addShapeless('ae_config_term_tj',item('appliedenergistics2:part', 521) ,[item('appliedenergistics2:part', 480),item('tjcore:advanced_logistics_core')])
crafting.addShapeless('ae_interface_terminal_tj',item('appliedenergistics2:part', 480),[item('tjcore:eletric_manager_module'),item('appliedenergistics2:part', 440),item('tjcore:advanced_logistics_core'),item('appliedenergistics2:part', 380)])
crafting.addShapeless('ae_pattern_terminal_tj',item('appliedenergistics2:part', 340),[item('tjcore:eletric_manager_module'),item('appliedenergistics2:material', 52),item('tjcore:advanced_logistics_core'),item('appliedenergistics2:part', 380)])

//Complex Recipes/Shaped Crafting
//Energy Acceptor          
crafting.removeByOutput(item('appliedenergistics2:energy_acceptor'))
Assembler.recipeBuilder()
   .EUt(VA[LV]).duration(300)
   .inputs(item('gregtech:meta_block_frame_20', 3), item('gregtech:meta_plate', 1012) * 4,
    item('gregtech:meta_plate', 323) * 4, item('gregtech:meta_bolt', 22) * 12, item('appliedenergistics2:part', 16) * 8, item('gregtech:machine', 1272))
   .fluidInputs(fluid("soldering_alloy") * 288)
   .outputs(item('appliedenergistics2:energy_acceptor'))
   .buildAndRegister()
// Fluix Ballast Core
Assembler.recipeBuilder()
   .EUt(VA[LV]).duration(160)
   .inputs(item('gregtech:meta_foil', 324) * 4, item('gregtech:meta_stick', 32001) * 4, item('gregtech:meta_foil', 1068) * 4, item('gregtech:meta_wire_fine', 25) *8)
   .fluidInputs(fluid("soldering_alloy") * 36)
   .outputs(item('tjcore:fluix_ballast_core') * 4)
   .buildAndRegister()
//Covered Cable (UnColored)
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(80)
   .inputs(item('tjcore:fluix_ballast_core') * 2, item('gregtech:meta_foil', 1012) * 16, item('gregtech:meta_wire_fine', 25) * 16)
   .fluidInputs(fluid("soldering_alloy") * 36)
   .outputs(item('appliedenergistics2:part', 36) * 16)
   .buildAndRegister()
//ITEM Interface - TODO later on add upgraded Tiers (starting from HV) That allow the user to make more at once to reduct Crafting times. Infrastructure Check!
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(80)
   .inputs(metaitem('conveyor.module.mv') * 2,metaitem('hull.hv'), ore('circuitMv'), item('appliedenergistics2:material', 43), item('appliedenergistics2:material', 44))
   .circuitMeta(0)
   .outputs(item('appliedenergistics2:interface') * 4)
   .buildAndRegister()
//FLUID Interface
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(80)
   .inputs(metaitem('electric.pump.mv') * 2,metaitem('hull.hv'),ore('circuitMv'),item('appliedenergistics2:material', 43),item('appliedenergistics2:material', 44))
   .circuitMeta(0)
   .outputs(item('appliedenergistics2:fluid_interface') * 4)
   .buildAndRegister()
//MD DRIVE - Gated by Cleanroom,Dust and other microparticles will cause critical failures in a drive bays item catalouge systems, however the drive access has been made human accessable..
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(80)
   .inputs(item('tjcore:advanced_logistics_core'),metaitem('frameStainlessSteel'),metaitem('plateDoubleStainlessSteel') * 5,metaitem('stickBlackSteel') * 8)
   .circuitMeta(0)
   .cleanroom(CleanroomType.CLEANROOM)
   .outputs(item('appliedenergistics2:drive'))
   .buildAndRegister()
//Patterns
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(80)
   .inputs(item('tjcore:advanced_logistics_core'),item('tjcore:eletric_manager_module'), metaitem('plateDoubleStainlessSteel') * 8)
   .circuitMeta(0)
   .cleanroom(CleanroomType.CLEANROOM)
   .outputs(item('appliedenergistics2:material', 52) * 16)
   .buildAndRegister()
//Eletric Manager
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(240)
   .inputs(metaitem('integrated_chip') * 8,metaitem('component.smd_capacitor_1') * 4,metaitem('integrated_board'),metaitem('wireFineElectrum') * 48)
   .circuitMeta(1)
   .cleanroom(CleanroomType.CLEANROOM)
   .outputs(item('tjcore:eletric_manager_module') * 8)
   .buildAndRegister()
//Adv Logic Core
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(240)
   .inputs(metaitem('integrated_chip') * 8,metaitem('plateFluixLaminatedGlass') * 4,metaitem('integrated_board'),metaitem('wireFineElectrum') * 48)
   .circuitMeta(0)
   .cleanroom(CleanroomType.CLEANROOM)
   .outputs(item('tjcore:advanced_logistics_core') * 8)
   .buildAndRegister()
//Crafting Core (Blank, NO Storage installed, leave those unchanged, the gating is done by the core block)
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(100)
   .inputs(item('tjcore:advanced_logistics_core'),metaitem('frameStainlessSteel'),metaitem('plateDoubleStainlessSteel') * 2)
   .circuitMeta(1)
   .outputs(item('appliedenergistics2:crafting_unit'))
   .buildAndRegister()
//Formation and Annil Cores, Needs Better things to replace the plates but it was 3AM okay.
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(100)
   .inputs(metaitem('plateGlowstone') * 2, metaitem('plateRedstone') *2,item('tjcore:fluix_ballast_core') * 2, metaitem('foilStainlessSteel') * 4)
   .circuitMeta(0)
   .cleanroom(CleanroomType.CLEANROOM)
   .outputs(item('appliedenergistics2:material', 44) * 4)
   .buildAndRegister()
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(100)
   .inputs(metaitem('plateEmerald') * 2, metaitem('plateLazurite') *2,item('tjcore:fluix_ballast_core') * 2, metaitem('foilStainlessSteel') * 4)
   .circuitMeta(0)
   .cleanroom(CleanroomType.CLEANROOM)
   .outputs(item('appliedenergistics2:material', 43) * 4)
   .buildAndRegister()
 //Mol Assembler
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(100)
   .inputs(metaitem('plateGlass') * 2, metaitem('robot.arm.mv'), item('appliedenergistics2:material', 43), item('appliedenergistics2:material', 44), item('gregtech:meta_block_frame_20', 3))
   .circuitMeta(1)
   .outputs(item('appliedenergistics2:molecular_assembler'))
   .buildAndRegister()
//Illuminated Panel
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(100)
   .inputs(metaitem('plateGlass') * 3, item('tjcore:basic_lcd'), item('appliedenergistics2:material', 44), item('gregtech:meta_block_frame_20', 3))
   .circuitMeta(0)
   .outputs(item('appliedenergistics2:part', 180) * 3)
   .buildAndRegister()
//Storage Cores

//storage_core_1
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(160)
   .inputs(ore('circuitMv')*2, item('tjcore:advanced_logistics_core') * 2, item('gregtech:meta_foil', 1012) * 16, metaitem('plateSteel') * 4)
   .fluidInputs(fluid('red_alloy') * 144)
   .outputs(item('tjcore:storage_core_1') * 8)
   .cleanroom(CleanroomType.CLEANROOM)
   .circuitMeta(1)
   .buildAndRegister()
//storage_core_2
//NYI
//storage_core_3
//NYI
//Storage Componenet 1k
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(160)
   .inputs(item('tjcore:fluix_ballast_core') * 2, metaitem('foilAnnealedCopper') * 4, metaitem('plateAluminium') * 2, item('appliedenergistics2:material', 43), item('appliedenergistics2:material', 44), item('tjcore:storage_core_1'))
   .fluidInputs(fluid("soldering_alloy") * 144)
   .outputs(item('appliedenergistics2:material', 35) * 2)
   .buildAndRegister()
//Storage Componenet 4k
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(80)
   .inputs(item('tjcore:fluix_ballast_core') * 2, metaitem('foilElectrum') * 8, metaitem('plateStainlessSteel') * 2, item('appliedenergistics2:material', 43), item('appliedenergistics2:material', 44), item('tjcore:storage_core_1')*2)
   .fluidInputs(fluid("soldering_alloy") * 288)
   .outputs(item('appliedenergistics2:material', 36) * 2)
   .buildAndRegister()














//Rest of Comps Here :)

//Fluid Storage Comps
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(160)
   .inputs(item('tjcore:fluix_ballast_core') * 2, metaitem('foilRubber') * 4, metaitem('platePlastic') * 2, item('appliedenergistics2:material', 43), item('appliedenergistics2:material', 44), item('tjcore:storage_core_1'))
   .fluidInputs(fluid("soldering_alloy") * 144)
   .outputs(item('appliedenergistics2:material', 54) * 2)
   .buildAndRegister()
//Storage Componenet 4k
Assembler.recipeBuilder()
   .EUt(VA[HV]).duration(80)
   .inputs(item('tjcore:fluix_ballast_core') * 2, metaitem('foilRubber') * 8, metaitem('platePolyvinylChloride') * 2, item('appliedenergistics2:material', 43), item('appliedenergistics2:material', 44), item('tjcore:storage_core_1')*2)
   .fluidInputs(fluid("soldering_alloy") * 288)
   .outputs(item('appliedenergistics2:material', 55) * 2)
   .buildAndRegister()
//fluix dust
Mixer.recipeBuilder()
   .EUt(VA[MV]).duration(60)
   .notConsumable(metaitem('shape.extruder.rod'))
   .inputs(metaitem('dustCertusQuartz'),metaitem('dustNetherQuartz'),item('minecraft:redstone'))
   .outputs(item('appliedenergistics2:material', 8)*3)
   .buildAndRegister()





















//Laminated Glass Rod & Plate
Laminator.recipeBuilder()
   .EUt(VA[MV]).duration(80)
   .inputs(metaitem('plateGlass'), ore('dustFluix'))
   .outputs(metaitem('plateFluixLaminatedGlass')* 2)
   .buildAndRegister()
Laminator.recipeBuilder()
   .EUt(VA[MV]).duration(80)
   .inputs(metaitem('stickGlass'), ore('dustFluix'))
   .outputs(metaitem('stickFluixLaminatedGlass')* 2)
   .buildAndRegister()
//AE Controller (Added for Masochists and Channel Enjoyers Alike)
Laminator.recipeBuilder()
   .EUt(VA[MV]).duration(80)
   .inputs(metaitem('transformer.hv'), metaitem('plateFluixLaminatedGlass'), item('tjcore:fluix_ballast_core'))
   .outputs(item('appliedenergistics2:controller')* 2)
   .buildAndRegister()
//ME Chest
crafting.addShaped('tj_me_chest', item('appliedenergistics2:chest'), [
        [ore('blockGlass'), item('tjcore:advanced_logistics_core') ,ore('blockGlass')],
        [item('appliedenergistics2:part', 36), null, item('appliedenergistics2:part', 36)], 
        [ore('plateIron'), item('tjcore:fluix_ballast_core')  , ore('plateIron')]
])
//Cell Workbench
crafting.addShaped('tj_me_cell_workbench', item('appliedenergistics2:cell_workbench'), [
        [ore('blockGlass'), item('minecraft:chest') ,ore('blockGlass')],
        [item('appliedenergistics2:part', 36), item('appliedenergistics2:memory_card'), item('appliedenergistics2:part', 36)], 
        [ore('plateIron'), item('tjcore:fluix_ballast_core')  , ore('plateIron')]
])
//Terminals
Assembler.recipeBuilder()
   .EUt(VA[MV]).duration(160)
   .inputs(metaitem('plateGlass'), metaitem('plateIron'), item('tjcore:fluix_ballast_core') * 4, item('tjcore:advanced_logistics_core'))
   .fluidInputs(fluid("glass") * 144)
   .circuitMeta(0)
   .outputs(item('appliedenergistics2:part', 380))
   .buildAndRegister()
//ME IO Port
crafting.addShaped('tj_me_cell_workbench2', item('appliedenergistics2:io_port'), [
        [ore('blockGlass'), item('minecraft:chest') ,ore('blockGlass')],
        [item('appliedenergistics2:drive'), null, item('appliedenergistics2:drive')], 
        [metaitem('plateDoubleIron'), item('tjcore:fluix_ballast_core')  , metaitem('plateDoubleIron')]
])
   