// priority: 0

onEvent('recipes', event => {
    let drawer_types = ['oak', 'spruce', 'birch', 'jungle', 'acacia', 'dark_oak', 'crimson', 'warped']
    let drawer_sizes = ['1', '2', '4']
    event.replaceInput({ id: SD('compacting_drawers_3') }, MC('iron_ingot'), F('#ingots/zinc'))
    event.remove({ output: SD("upgrade_template") })

    drawer_types.forEach(e => {

        let trim = SD(`${e}_trim`)
        let plank = MC(`${e}_planks`)
        event.remove({ id: trim })
        event.shaped(Item.of(trim, 4), [
            'SSS',
            'PMP',
            'SSS'
        ], {
            P: F('#ingots/zinc'),
            M: '#forge:chests/wooden',
            S: plank
        })

        event.stonecutting(SD("upgrade_template"), trim)

        drawer_sizes.forEach(size => {
            let full = SD(`${e}_full_drawers_${size}`)
            let half = SD(`${e}_half_drawers_${size}`)
            event.remove({ id: full })
            event.remove({ id: half })
            event.stonecutting(full, trim)
            event.stonecutting(Item.of(half, 2), trim)
        })
    })
})