// priority: 0

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

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)])
})