// priority: 0

// Visit the wiki for more info - https://kubejs.com/

// made by blueversal

ServerEvents.recipes(event => {
  event.remove({ output: 'minecraft:iron_helmet' })
  event.remove({ output: 'minecraft:iron_chestplate' })
  event.remove({ output: 'minecraft:iron_leggings' })
  event.remove({ output: 'minecraft:iron_boots' })
  event.remove({ output: 'minecraft:golden_helmet' })
  event.remove({ output: 'minecraft:golden_chestplate' })
  event.remove({ output: 'minecraft:golden_leggings' })
  event.remove({ output: 'minecraft:golden_boots' })
  event.remove({ output: 'minecraft:chainmail_helmet' })
  event.remove({ output: 'minecraft:chainmail_chestplate' })
  event.remove({ output: 'minecraft:chainmail_leggings' })
  event.remove({ output: 'minecraft:chainmail_boots' })
  event.remove({ output: 'minecraft:iron_horse_armor' })
  event.remove({ output: 'minecraft:golden_horse_armor' })

  const ironPlate = 'create:iron_sheet';
  const goldPlate = 'create:golden_sheet';
  const ironIngot = 'minecraft:iron_ingot';
  const goldIngot = 'minecraft:gold_ingot';
  const armorShapes = {
      helmet: ['PpP', 'p p'],
      chestplate: ['p p', 'PPP', 'pPp'],
      leggings: ['PpP', 'p p', 'P P'],
      boots: ['p p', 'P P']
  };

  for (const [armor, pattern] of Object.entries(armorShapes)) {
      event.shaped(`minecraft:iron_${armor}`, pattern, { P: ironIngot, p: ironPlate });
      event.shaped(`minecraft:golden_${armor}`, pattern, { P: goldIngot, p: goldPlate });
  }
  event.shaped('minecraft:iron_horse_armor', ['p p', 'PpP', 'p p'], { P: ironIngot, p: ironPlate });
  event.shaped('minecraft:golden_horse_armor', ['p p', 'PpP', 'p p'], { P: goldIngot, p: goldPlate });
});