/*
  i spent some time configuring this and then it was entirely rewritten
  forcing people who have already configured it to reconfigure it from scratch

  asshole
*/

ServerEvents.recipes(event => {

  let weapheads =
    [
      "battle_hammer",
      "battleaxe",
      "flanged_mace",
      "halberd",
      "warhammer",
    ]

  let blades =
    [
      "longsword",
      "greatsword"
    ]

  event.custom({
    "type": "overgeared:item_to_tooltype",
    "item": [
      {
        "item": "kubejs:stone_hammer_head"
      },
      {
        "item": "kubejs:iron_hammer_head"
      },
      {
        "item": "kubejs:diamond_hammer_head"
      }
    ],
    "tooltype": "excav_hammer"
  })

  event.custom({
    "type": "overgeared:item_to_tooltype",
    "item": [
      {
        "item": "kubejs:stone_tip"
      },
      {
        "item": "kubejs:iron_spearhead"
      },
      {
        "item": "kubejs:steel_spearhead"
      },
      {
        "item": "kubejs:diamond_spearhead"
      }
    ],
    "tooltype": "spearhead"
  })

  event.custom({
    "type": "overgeared:item_to_tooltype",
    "item": [
      {
        "item": "kubejs:iron_curved_blade"
      },
      {
        "item": "kubejs:steel_curved_blade"
      },
      {
        "item": "kubejs:diamond_curved_blade"
      }
    ],
    "tooltype": "curved_blade"
  })

  event.custom({
    "type": "overgeared:item_to_tooltype",
    "item": [
      {
        "item": "kubejs:iron_blade"
      },
      {
        "item": "kubejs:steel_blade"
      },
      {
        "item": "kubejs:diamond_blade"
      }
    ],
    "tooltype": "blade"
  })

  event.custom({
    "type": "overgeared:item_to_tooltype",
    "item": [
      {
        "item": "kubejs:iron_cleaver_blade"
      },
      {
        "item": "kubejs:diamond_cleaver_blade"
      }
    ],
    "tooltype": "cleaver"
  })

  weapheads.forEach(head => (

    event.custom({
      "type": "overgeared:item_to_tooltype",
      "item": [
        {
          "item": `kubejs:iron_${head}_head`
        },
        {
          "item": `kubejs:steel_${head}_head`
        },
        {
          "item": `kubejs:diamond_${head}_head`
        }
      ],
      "tooltype": `${head}`
    })
  ))

  blades.forEach(blade => (

    event.custom({
      "type": "overgeared:item_to_tooltype",
      "item": [
        {
          "item": `kubejs:iron_${blade}_blade`
        },
        {
          "item": `kubejs:steel_${blade}_blade`
        },
        {
          "item": `kubejs:diamond_${blade}_blade`
        }
      ],
      "tooltype": `${blade}`
    })
  ))

})