// priority: 0

const defaultExtractingTime = (25600 * 1) //25600 = 10 sec
const oreDefaults = {
    coal: {
        time: defaultExtractingTime,
        output: EE("coal_fragment"),
        minOutput: 1,
        maxOutput: 1,
    },
    copper: {
        time: defaultExtractingTime,
        output: EE("copper_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    zinc: {
        time: defaultExtractingTime,
        output: EE("zinc_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    iron: {
        time: defaultExtractingTime,
        output: MC("iron_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    gold: {
        time: defaultExtractingTime,
        output: MC("gold_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    diamond: {
        time: defaultExtractingTime * 1.5,
        output: EE("diamond_fragment"),
        minOutput: 1,
        maxOutput: 1,
    },
    lapis: {
        time: defaultExtractingTime,
        output: EE("lapis_fragment"),
        minOutput: 1,
        maxOutput: 1,
    },
    redstone: {
        time: defaultExtractingTime * 1.5,
        output: MC("redstone"),
        minOutput: 1,
        maxOutput: 1,
    },
    ruby: {
        time: defaultExtractingTime,
        output: EE("ruby_fragment"),
        minOutput: 1,
        maxOutput: 1,
    },
    sapphire: {
        time: defaultExtractingTime,
        output: EE("sapphire_fragment"),
        minOutput: 1,
        maxOutput: 1,
    },
    tin: {
        time: defaultExtractingTime,
        output: EE("tin_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    uranium: {
        time: defaultExtractingTime,
        output: EE("uranium_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    lead: {
        time: defaultExtractingTime,
        output: EE("lead_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    osmium: {
        time: defaultExtractingTime,
        output: EE("osmium_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    fluorite: {
        time: defaultExtractingTime,
        output: EE("fluorite_fragment"),
        minOutput: 1,
        maxOutput: 1,
    },
    quartz: {
        time: defaultExtractingTime,
        output: EE("quartz_fragment"),
        minOutput: 1,
        maxOutput: 1,
    },
    cobalt: {
        time: defaultExtractingTime,
        output: EE("cobalt_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
    netherite_scrap: {
        time: defaultExtractingTime * 2,
        output: TC("debris_nugget"),
        minOutput: 1,
        maxOutput: 1,
    },
}

onEvent('recipes', event => {
    //removals
    removeRecipeByID(event, [
        CRA("picker"),
        CRA("drill_head"),
        CRA("lava_sponge_frame_from_sponge"),
    ])

    //drill head
	event.shaped(CRA('drill_head'), [
		' NN',
		'PLN',
		'BP '
	], {
		N: F('#nuggets/iron'),
		P: F('#plates/iron'),
		L: F('#ingots/cobalt'),
		B: F('#storage_blocks/iron')
	})

    event.remove({ type: CRA("extracting") })
    event.remove({ type: CRA("picking") })
    event.remove({ mod: CRA(), type: CR("mixing") })
    event.remove({ mod: CRA(), type: CR("crushing") })
    event.remove({ mod: CRA(), type: CR("deploying") })

    //ore extracting
    for (let ore in oreDefaults) {
        event.custom({
            "type": CRA("extracting"),
            "node": {
                "tag": F(`ores/${ore}`)
            },
            "output": oreDefaults[ore].output,
            "drillDamage": 0,
            "requiredProgress": oreDefaults[ore].time,
            "minOre": oreDefaults[ore].minOutput,
            "maxOre": oreDefaults[ore].maxOutput
        })
    }

    //wet sponge sail
	event.shapeless(CRA('wet_sponge_sail'), [MC("sponge"), Item.of(CR("sail_frame"), 4), MC("water_bucket")])
	event.recipes.createFilling(CRA('wet_sponge_sail'), [CRA("sponge_sail"), Fluid.of(MC('water'), 250)])

    //lava sponge sail
	event.shapeless(CRA('lava_sponge_sail'), [MC("sponge"), Item.of(CR("sail_frame"), 4), MC("lava_bucket")])
	event.shapeless(CRA('lava_sponge_sail'), [CRA("sponge_sail"), MC("lava_bucket")])
	event.recipes.createFilling(CRA('lava_sponge_sail'), [CRA("sponge_sail"), Fluid.of(MC('lava'), 250)])
})