events.listen('recipes', function (e) {
    
    function upgrade(mod, material, previous, next){
        e.remove({id: mod+':'+next+'_helmet'})
        e.remove({id: mod+':'+next+'_chestplate'})
        e.remove({id: mod+':'+next+'_leggings'})
        e.remove({id: mod+':'+next+'_boots'})
            e.recipes.allthemodium.atmshaped_crafting({
                pattern: [
                  'XXX',
                  'XYX'
                ],
                key: {
                  X: {
                    tag: 'forge:'+material
                  },
                  Y: {
                    item: previous+'_helmet'
                  }
                },
                result: {
                  item: mod+':'+next+'_helmet'
                }
            })
            e.recipes.allthemodium.atmshaped_crafting({
                pattern: [
                  'XYX',
                  'XXX',
                  'XXX'
                ],
                key: {
                  X: {
                    tag: 'forge:'+material
                  },
                  Y: {
                    item: previous+'_chestplate'
                  }
                },
                result: {
                  item: mod+':'+next+'_chestplate'
                }
            })
            e.recipes.allthemodium.atmshaped_crafting({
                pattern: [
                  'XXX',
                  'XYX',
                  'X X'
                ],
                key: {
                  X: {
                    tag: 'forge:'+material
                  },
                  Y: {
                    item: previous+'_leggings'
                  }
                },
                result: {
                  item: mod+':'+next+'_leggings'
                }
            })
            e.recipes.allthemodium.atmshaped_crafting({
                pattern: [
                  'XYX',
                  'X X'
                ],
                key: {
                  X: {
                    tag: 'forge:'+material
                  },
                  Y: {
                    item: previous+'_boots'
                  }
                },
                result: {
                  item: mod+':'+next+'_boots'
                }
            })
    }
    upgrade('minecraft', 'ingots/iron', 'minecraft:leather', 'iron')
    upgrade('minecraft', 'gems/diamond', 'minecraft:iron', 'diamond')
    e.remove({id: 'allthemodium:allthemodium_helmet'})
    e.remove({id: 'allthemodium:allthemodium_chestplate'})
    e.remove({id: 'allthemodium:allthemodium_leggings'})
    e.remove({id: 'allthemodium:allthemodium_boots'})
    upgrade('allthemodium', 'ingots/allthemodium', 'minecraft:netherite', 'allthemodium')
})