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

//Whatever the hell the funny REMOVAL X is in JEI makes these. This handles removal of VANILLA GT RECIPES - Yes it's absolutely ass to read. GL.
// Chloroauric Acid * 2000
mods.gregtech.electrolyzer.removeByInput(480, [metaitem('dustGold') * 2], [fluid('hydrochloric_acid') * 8000])
// Gold Dust * 1
// mods.gregtech.electrolyzer.removeByInput(60, null, [fluid('gtfo_chloroauric_acid') * 1000])
// Phenolic Circuit Board * 1
mods.gregtech.assembler.removeByInput(7, [metaitem('dustWood'), metaitem('shape.mold.plate')], [fluid('glue') * 50])
// Good Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('foilSilver') * 4, metaitem('board.phenolic')], [fluid('iron_iii_chloride') * 100])
// Good Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('foilSilver') * 4, metaitem('board.phenolic')], [fluid('sodium_persulfate') * 200])
// Plastic Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('board.plastic'), metaitem('foilCopper') * 6], [fluid('iron_iii_chloride') * 250])
// Advanced Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('board.epoxy'), metaitem('foilElectrum') * 8], [fluid('iron_iii_chloride') * 500])
// Extreme Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('board.fiber_reinforced'), metaitem('foilAnnealedCopper') * 12], [fluid('iron_iii_chloride') * 1000])
// Elite Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(120, [metaitem('board.multilayer.fiber_reinforced'), metaitem('foilPlatinum') * 8], [fluid('iron_iii_chloride') * 2000])
// Master Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(480, [metaitem('board.wetware'), metaitem('foilNiobiumTitanium') * 32], [fluid('iron_iii_chloride') * 5000])
// Plastic Circuit Board * 2
mods.gregtech.chemical_reactor.removeByInput(10, [metaitem('platePolyvinylChloride'), metaitem('foilCopper') * 4], [fluid('sulfuric_acid') * 250])
// Plastic Circuit Board * 8
mods.gregtech.chemical_reactor.removeByInput(10, [metaitem('platePolybenzimidazole'), metaitem('foilCopper') * 4], [fluid('sulfuric_acid') * 250])
// Plastic Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(10, [metaitem('platePlastic'), metaitem('foilCopper') * 4], [fluid('sulfuric_acid') * 250])
// Plastic Circuit Board * 4
mods.gregtech.chemical_reactor.removeByInput(10, [metaitem('platePolytetrafluoroethylene'), metaitem('foilCopper') * 4], [fluid('sulfuric_acid') * 250])
// Epoxy Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('plateEpoxy'), metaitem('foilGold') * 8], [fluid('sulfuric_acid') * 500])
// Fiber-Reinforced Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(10, [metaitem('plateReinforcedEpoxyResin'), metaitem('foilAnnealedCopper') * 8], [fluid('sulfuric_acid') * 125])
// Multi-layer Fiber-Reinforced Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(480, [metaitem('board.fiber_reinforced') * 2, metaitem('foilPlatinum') * 8], [fluid('sulfuric_acid') * 500])
// Good Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('foilSilver') * 4, metaitem('board.phenolic')], [fluid('iron_iii_chloride') * 100])
// Good Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('foilSilver') * 4, metaitem('board.phenolic')], [fluid('sodium_persulfate') * 200])
// Master Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(480, [metaitem('board.wetware'), metaitem('foilNiobiumTitanium') * 32], [fluid('sodium_persulfate') * 10000])
// Elite Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(120, [metaitem('board.multilayer.fiber_reinforced'), metaitem('foilPlatinum') * 8], [fluid('sodium_persulfate') * 4000])
// Extreme Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('board.fiber_reinforced'), metaitem('foilAnnealedCopper') * 12], [fluid('sodium_persulfate') * 2000])
// Advanced Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('board.epoxy'), metaitem('foilElectrum') * 8], [fluid('sodium_persulfate') * 1000])
// Plastic Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('board.plastic'), metaitem('foilCopper') * 6], [fluid('iron_iii_chloride') * 250])
// Advanced Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('board.epoxy'), metaitem('foilElectrum') * 8], [fluid('iron_iii_chloride') * 500])
// Master Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(480, [metaitem('board.wetware'), metaitem('foilNiobiumTitanium') * 32], [fluid('iron_iii_chloride') * 5000])
// Elite Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(120, [metaitem('board.multilayer.fiber_reinforced'), metaitem('foilPlatinum') * 8], [fluid('iron_iii_chloride') * 2000])
// Extreme Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('board.fiber_reinforced'), metaitem('foilAnnealedCopper') * 12], [fluid('iron_iii_chloride') * 1000])
// Plastic Circuit Board * 1
mods.gregtech.chemical_reactor.removeByInput(30, [metaitem('board.plastic'), metaitem('foilCopper') * 6], [fluid('sodium_persulfate') * 500])
// Advanced Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('board.epoxy'), metaitem('foilElectrum') * 8], [fluid('sodium_persulfate') * 1000])
// Extreme Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('board.fiber_reinforced'), metaitem('foilAnnealedCopper') * 12], [fluid('sodium_persulfate') * 2000])
// Elite Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(120, [metaitem('board.multilayer.fiber_reinforced'), metaitem('foilPlatinum') * 8], [fluid('sodium_persulfate') * 4000])
// Master Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(480, [metaitem('board.wetware'), metaitem('foilNiobiumTitanium') * 32], [fluid('sodium_persulfate') * 10000])
// Plastic Circuit Board * 1
mods.gregtech.large_chemical_reactor.removeByInput(30, [metaitem('board.plastic'), metaitem('foilCopper') * 6], [fluid('sodium_persulfate') * 500])
// Sodium Dust * 1
mods.gregtech.electrolyzer.removeByInput(60, [metaitem('dustSodiumHydroxide') * 3], null)
// Infinite Water Cover * 1
mods.gregtech.assembler.removeByInput(480, [metaitem('electric.pump.hv') * 2, item('minecraft:cauldron'), metaitem('circuit.electronic_hv')], null)
// Glass Rod * 2
mods.gregtech.lathe.removeByInput(16, [metaitem('gemGlass')], null)
// UHV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateNeutronium') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// ZPM Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateNaquadahAlloy') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// LuV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateRhodiumPlatedPalladium') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// IV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateTungstenSteel') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// EV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateTitanium') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// HV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateStainlessSteel') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// MV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateAluminium') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// LV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateSteel') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// UV Machine Casing * 1
mods.gregtech.assembler.removeByInput(16, [metaitem('plateDarmstadtium') * 8, metaitem('circuit.integrated').withNbt(["Configuration": 8])], null)
// LV Sensor * 1
mods.gregtech.assembler.removeByInput(30, [metaitem('stickBrass'), metaitem('plateSteel') * 4, metaitem('circuit.primitive_lv'), metaitem('gemQuartzite')], null)
// MV Sensor * 1
mods.gregtech.assembler.removeByInput(30, [metaitem('stickElectrum'), metaitem('plateAluminium') * 4, metaitem('circuit.primitive_mv'), metaitem('gemFlawlessEmerald')], null)
// HV Sensor * 1
mods.gregtech.assembler.removeByInput(30, [metaitem('stickChrome'), metaitem('plateStainlessSteel') * 4, metaitem('circuit.electronic_hv'), item('minecraft:ender_eye')], null)
// EV Sensor * 1
mods.gregtech.assembler.removeByInput(480, [metaitem('stickLongTitanium') * 2, metaitem('foilChrome') * 8, metaitem('screwTitanium') * 16, metaitem('circuit.integrated_ev'), metaitem('gemOpal')], [fluid('soldering_alloy') * 144])
// IV Sensor * 1
mods.gregtech.assembler.removeByInput(30, [metaitem('stickIridium'), metaitem('plateTungstenSteel') * 4, metaitem('circuit.micro_iv'), metaitem('quantumstar')], null)



//MANUAL REMOVALS (Not JEI X)
// mods.jei.yeet(fluid('gtfo_chloroauric_acid'))


//gregtech.removeByOutput(metaitem('stickGlass'))

crafting.removeByOutput(item('gregtech:machine', 1001))
//ADDITIONS
//Hydroxide Loop
Electrolyzer.recipeBuilder()
   .EUt(VA[MV]).duration(100)
   .inputs(metaitem('dustSodiumHydroxide') * 3)
   .outputs(metaitem('dustSodium'))
   .fluidOutputs(fluid('hydrogen') * 1000)
   .fluidOutputs(fluid('oxygen') * 1000)
   .buildAndRegister()
ChemReactor.recipeBuilder()
   .EUt(VA[MV]).duration(20)
   .inputs(metaitem('dustSodium'))
   .fluidInputs(fluid('water') * 1000)
   .outputs(metaitem('dustSodiumHydroxide') * 3)
   .fluidOutputs(fluid('hydrogen') * 1000)
   .buildAndRegister()
//Gold Chain

Roasting.recipeBuilder()
   .EUt(VA[LV]).duration(40)
   .inputs(ore('dustPreciousMetal') * 4)
   .fluidInputs(fluid('chlorine') * 2000)
   .outputs(item('minecraft:gold_ingot')*2)
   .fluidOutputs(fluid('auric_sludge') * 2000)
   .buildAndRegister()
Centrifuge.recipeBuilder()
   .EUt(VA[LV]).duration(160)
   .fluidInputs(fluid('auric_sludge') * 1000)
   .fluidOutputs(fluid('chlorine') * 1000)
   .chancedOutput(metaitem('dustSilver'), 6500, 500)
   .chancedOutput(metaitem('dustCopper'), 2500, 500)
   .chancedOutput(metaitem('dustLead'), 550, 500)
   .chancedOutput(metaitem('dustGold'), 750, 500)
   .buildAndRegister()
//EBF Aluminium Removal and TJ Recipe
EBF.recipeBuilder()
   .EUt(VA[LV]).duration(600)
   .inputs(metaitem('dustAlumina') * 10,metaitem('dustCarbon') * 3)
   .outputs(metaitem('ingotAluminium') * 4)
   .fluidOutputs(fluid('carbon_dioxide') * 3000)
   .buildAndRegister()

//Glass Rod
Extruder.recipeBuilder()
   .EUt(VA[MV]).duration(60)
   .notConsumable(metaitem('shape.extruder.rod'))
   .inputs(metaitem('dustGlass'))
   .outputs(metaitem('stickGlass') * 2)
   .buildAndRegister()
//EIO Metals
EBF.recipeBuilder()
   .EUt(VA[MV]).duration(400)
   .inputs(metaitem('ingotSteel'),metaitem('dustEnderPearl'))
   .blastFurnaceTemp(1600)
   .fluidInputs(fluid('nitrogen')*1000)
   .outputs(metaitem('ingotPulsatingSteel'))
   .buildAndRegister()
EBF.recipeBuilder()
   .EUt(VA[MV]).duration(400)
   .inputs(metaitem('ingotRoseGold') * 2 ,metaitem('ingotBronze') * 2)
   .blastFurnaceTemp(1600)
   .fluidInputs(fluid('nitrogen')*1000)
   .outputs(metaitem('ingotEnergeticAlloy') * 4)
   .buildAndRegister()
EBF.recipeBuilder()
   .EUt(VA[MV]).duration(400)
   .inputs(metaitem('ingotEnergeticAlloy') * 2 ,metaitem('ingotPulsatingSteel') * 2)
   .blastFurnaceTemp(1600)
   .fluidInputs(fluid('argon')*50)
   .outputs(metaitem('ingotVibrantAlloy') * 4)
   .buildAndRegister()
EBF.recipeBuilder()
   .EUt(VA[MV]).duration(400)
   .inputs(metaitem('ingotDarkSteel'),item('astralsorcery:itemusabledust', 1) * 3)
   .blastFurnaceTemp(4900)
   .fluidInputs(fluid('xenon')*100)
   .outputs(metaitem('ingotMidnightSteel') * 2)
   .buildAndRegister()





//Additions
//3x3 crafting
crafting.addShaped('tj_EBF', item('gregtech:machine', 1001), [
        [item('ironfurnaces:iron_furnace_idle'), item('ironfurnaces:iron_furnace_idle') ,item('ironfurnaces:iron_furnace_idle')],
        [ore('circuitMv'), item('gregtech:metal_casing', 2), ore('circuitMv')], 
        [metaitem('wireGtDoubleCopper'), ore('circuitHv')  , metaitem('wireGtDoubleCopper')]
])