ServerEvents.recipes(ice_and_fire_magic => {
global.mekStackAdditions.forEach(entry => {
let material = entry.material

let dust = AlmostUnified.getPreferredItemForTag(`forge:dusts/${material}`)
if (entry.makeDust) {
dust = Item.of(`kubejs:dust_${material}`)
} else if (dust.isEmpty() && !Ingredient.of(`#forge:dusts/${material}`).isEmpty()) {
dust = Ingredient.of(`#forge:dusts/${material}`).getFirst()
}
let hasDust = !dust.isEmpty()

if (!Ingredient.of(`#forge:storage_blocks/raw_${material}`).isEmpty()) {
ice_and_fire_magic.custom({
type: 'mekanism:dissolution',
itemInput: {
ingredient: {
tag: `forge:storage_blocks/raw_${material}`
}
},
output: {
slurry: `kubejs:dirty_${material}`,
amount: 6000,
chemicalType: 'slurry'
},
gasInput: {
amount: 2,
gas: 'mekanism:sulfuric_acid'
}
}).id(`ice_and_fire_magic:processing/${material}/slurry/dirty/from_raw_block`)
ice_and_fire_magic.custom({
type: 'mekanism:injecting',
itemInput: {
ingredient: {
tag: `forge:storage_blocks/raw_${material}`
}
},
chemicalInput: {
amount: 2,
gas: 'mekanism:hydrogen_chloride'
},
output: {
item: `kubejs:shard_${material}`,
count: 24
}
}).id(`ice_and_fire_magic:processing/${material}/shard/from_raw_block`)
ice_and_fire_magic.custom({
type: 'mekanism:purifying',
itemInput: {
ingredient: {
tag: `forge:storage_blocks/raw_${material}`
}
},
chemicalInput: {
amount: 2,
gas: 'mekanism:oxygen'
},
output: {
item: `kubejs:clump_${material}`,
count: 18
}
}).id(`ice_and_fire_magic:processing/${material}/clump/from_raw_block`)
if (hasDust) {
ice_and_fire_magic.custom({
type: 'mekanism:enriching',
input: {
ingredient: {
tag: `forge:storage_blocks/raw_${material}`
}
},
output: {
item: dust.id,
count: 12
}
}).id(`ice_and_fire_magic:processing/${material}/dust/from_raw_block`)
}
}

if (!Ingredient.of(`#forge:ores/${material}`).isEmpty()) {
ice_and_fire_magic.custom({
type: 'mekanism:dissolution',
itemInput: {
ingredient: {
tag: `forge:ores/${material}`
}
},
output: {
slurry: `kubejs:dirty_${material}`,
amount: 1000,
chemicalType: 'slurry'
},
gasInput: {
amount: 1,
gas: 'mekanism:sulfuric_acid'
}
}).id(`ice_and_fire_magic:processing/${material}/slurry/dirty/from_ore`)
ice_and_fire_magic.custom({
type: 'mekanism:injecting',
itemInput: {
ingredient: {
tag: `forge:ores/${material}`
}
},
chemicalInput: {
amount: 1,
gas: 'mekanism:hydrogen_chloride'
},
output: {
item: `kubejs:shard_${material}`,
count: 4
}
}).id(`ice_and_fire_magic:processing/${material}/shard/from_ore`)
ice_and_fire_magic.custom({
type: 'mekanism:purifying',
itemInput: {
ingredient: {
tag: `forge:ores/${material}`
}
},
chemicalInput: {
amount: 1,
gas: 'mekanism:oxygen'
},
output: {
item: `kubejs:clump_${material}`,
count: 3
}
}).id(`ice_and_fire_magic:processing/${material}/clump/from_ore`)
if (hasDust) {
ice_and_fire_magic.custom({
type: 'mekanism:enriching',
input: {
ingredient: {
tag: `forge:ores/${material}`
}
},
output: {
item: dust.id,
count: 2
}
}).id(`ice_and_fire_magic:processing/${material}/dust/from_ore`)
}
}

if (!Ingredient.of(`#forge:raw_materials/${material}`).isEmpty()) {
ice_and_fire_magic.custom({
type: 'mekanism:dissolution',
itemInput: {
amount: 3,
ingredient: {
tag: `forge:raw_materials/${material}`
}
},
output: {
slurry: `kubejs:dirty_${material}`,
amount: 2000,
chemicalType: 'slurry'
},
gasInput: {
amount: 1,
gas: 'mekanism:sulfuric_acid'
}
}).id(`ice_and_fire_magic:processing/${material}/slurry/dirty/from_raw_ore`)
ice_and_fire_magic.custom({
type: 'mekanism:injecting',
itemInput: {
amount: 3,
ingredient: {
tag: `forge:raw_materials/${material}`
}
},
chemicalInput: {
amount: 1,
gas: 'mekanism:hydrogen_chloride'
},
output: {
item: `kubejs:shard_${material}`,
count: 8
}
}).id(`ice_and_fire_magic:processing/${material}/shard/from_raw_ore`)
ice_and_fire_magic.custom({
type: 'mekanism:purifying',
itemInput: {
ingredient: {
tag: `forge:raw_materials/${material}`
}
},
chemicalInput: {
amount: 1,
gas: 'mekanism:oxygen'
},
output: {
item: `kubejs:clump_${material}`,
count: 2
}
}).id(`ice_and_fire_magic:processing/${material}/clump/from_raw_ore`)
if (hasDust) {
ice_and_fire_magic.custom({
type: 'mekanism:enriching',
input: {
amount: 3,
ingredient: {
tag: `forge:raw_materials/${material}`
}
},
output: {
item: dust.id,
count: 4
}
}).id(`ice_and_fire_magic:processing/${material}/dust/from_raw_ore`)
}
}

ice_and_fire_magic.custom({
type: 'mekanism:washing',
fluidInput: {
amount: 5,
fluid: 'minecraft:water'
},
slurryInput: {
amount: 1,
slurry: `kubejs:dirty_${material}`
},
output: {
slurry: `kubejs:clean_${material}`,
amount: 1
}
}).id(`ice_and_fire_magic:processing/${material}/slurry/clean`)
ice_and_fire_magic.custom({
type: 'mekanism:crystallizing',
chemicalType: 'slurry',
input: {
amount: 200,
slurry: `kubejs:clean_${material}`
},
output: {
item: `kubejs:crystal_${material}`
}
}).id(`ice_and_fire_magic:processing/${material}/crystal/from_slurry`)
ice_and_fire_magic.custom({
type: 'mekanism:injecting',
itemInput: {
ingredient: {
tag: `mekanism:crystals/${material}`
}
},
chemicalInput: {
amount: 1,
gas: 'mekanism:hydrogen_chloride'
},
output: {
item: `kubejs:shard_${material}`
}
}).id(`ice_and_fire_magic:processing/${material}/shard/from_crystal`)
ice_and_fire_magic.custom({
type: 'mekanism:purifying',
itemInput: {
ingredient: {
tag: `mekanism:shards/${material}`
}
},
chemicalInput: {
amount: 1,
gas: 'mekanism:oxygen'
},
output: {
item: `kubejs:clump_${material}`
}
}).id(`ice_and_fire_magic:processing/${material}/clump/from_shard`)
ice_and_fire_magic.custom({
type: 'mekanism:crushing',
input: {
ingredient: {
tag: `mekanism:clumps/${material}`
}
},
output: {
item: `kubejs:dirty_dust_${material}`
}
}).id(`ice_and_fire_magic:processing/${material}/dirty_dust/from_clump`)
if (hasDust) {
ice_and_fire_magic.custom({
type: 'mekanism:enriching',
input: {
ingredient: {
tag: `mekanism:dirty_dusts/${material}`
}
},
output: {
item: dust.id
}
}).id(`ice_and_fire_magic:processing/${material}/dust/from_dirty_dust`)
}
})
})