MMEvents.createProcesses(event => {
  function createSmithing(inputItem, outputItem, templateItem) {
    if (!templateItem) {
      templateItem = 'minecraft:netherite_upgrade_smithing_template';
    }

    event
      .create(`mm:smithing/${outputItem.replace(':', '_')}`)
      .structureId('mm:smithing_structure')
      .ticks(4)
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: inputItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: 'minecraft:netherite_ingot',
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: templateItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:energy',
          amount: 1000
        }
      })
      .output({
        type: 'mm:output/simple',
        ingredient: {
          type: 'mm:item',
          item: outputItem,
          count: 1
        }
      });
  }

  // Recettes vanilla netherite
  createSmithing('minecraft:diamond_sword', 'minecraft:netherite_sword');
  createSmithing('minecraft:diamond_pickaxe', 'minecraft:netherite_pickaxe');
  createSmithing('minecraft:diamond_shovel', 'minecraft:netherite_shovel');
  createSmithing('minecraft:diamond_axe', 'minecraft:netherite_axe');
  createSmithing('minecraft:diamond_hoe', 'minecraft:netherite_hoe');
  createSmithing('minecraft:diamond_helmet', 'minecraft:netherite_helmet');
  createSmithing('minecraft:diamond_leggings', 'minecraft:netherite_leggings');
  createSmithing('minecraft:diamond_chestplate', 'minecraft:netherite_chestplate');
  createSmithing('minecraft:diamond_boots', 'minecraft:netherite_boots');
  createSmithing('functionalstorage:diamond_upgrade', 'functionalstorage:netherite_upgrade');
  
});
MMEvents.createProcesses(event => {
  function createSmithing(inputItem, outputItem, templateItem) {
    if (!templateItem) {
      templateItem = 'minecraft:netherite_upgrade_smithing_template';
    }

    event
      .create(`mm:smithing/${outputItem.replace(':', '_')}`)
      .structureId('mm:smithing_structure')
      .ticks(4)
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: inputItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: 'allthemodium:unobtainium_ingot',
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: templateItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:energy',
          amount: 1000
        }
      })
      .output({
        type: 'mm:output/simple',
        ingredient: {
          type: 'mm:item',
          item: outputItem,
          count: 1
        }
      });
  }

  // Unobtainium — template dans allthemodium
  const unobtainiumTemplate = 'allthemodium:unobtainium_upgrade_smithing_template';

createSmithing('allthemodium:vibranium_hoe', 'allthemodium:unobtainium_hoe', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_shovel', 'allthemodium:unobtainium_shovel', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_pickaxe', 'allthemodium:unobtainium_pickaxe', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_sword', 'allthemodium:unobtainium_sword', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_chestplate', 'allthemodium:unobtainium_chestplate', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_boots', 'allthemodium:unobtainium_boots', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_axe', 'allthemodium:unobtainium_axe', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_helmet', 'allthemodium:unobtainium_helmet', unobtainiumTemplate);
createSmithing('allthemodium:vibranium_leggings', 'allthemodium:unobtainium_leggings', unobtainiumTemplate);
});
MMEvents.createProcesses(event => {
  function createSmithing(inputItem, outputItem, templateItem) {
    if (!templateItem) {
      templateItem = 'minecraft:netherite_upgrade_smithing_template';
    }

    event
      .create(`mm:smithing/${outputItem.replace(':', '_')}`)
      .structureId('mm:smithing_structure')
      .ticks(4)
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: inputItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: 'allthemodium:vibranium_ingot',
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: templateItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:energy',
          amount: 1000
        }
      })
      .output({
        type: 'mm:output/simple',
        ingredient: {
          type: 'mm:item',
          item: outputItem,
          count: 1
        }
      });
  }

  // Vibranium — template dans allthemodium
  const vibraniumTemplate = 'allthemodium:vibranium_upgrade_smithing_template';

createSmithing('allthemodium:allthemodium_hoe', 'allthemodium:vibranium_hoe', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_shovel', 'allthemodium:vibranium_shovel', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_pickaxe', 'allthemodium:vibranium_pickaxe', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_sword', 'allthemodium:vibranium_sword', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_chestplate', 'allthemodium:vibranium_chestplate', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_boots', 'allthemodium:vibranium_boots', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_axe', 'allthemodium:vibranium_axe', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_helmet', 'allthemodium:vibranium_helmet', vibraniumTemplate);
createSmithing('allthemodium:allthemodium_leggings', 'allthemodium:vibranium_leggings', vibraniumTemplate);
});
MMEvents.createProcesses(event => {
  function createSmithing(inputItem, outputItem, templateItem) {
    if (!templateItem) {
      templateItem = 'minecraft:netherite_upgrade_smithing_template';
    }

    event
      .create(`mm:smithing/${outputItem.replace(':', '_')}`)
      .structureId('mm:smithing_structure')
      .ticks(4)
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: inputItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: 'allthemodium:allthemodium_ingot',
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: templateItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:energy',
          amount: 1000
        }
      })
      .output({
        type: 'mm:output/simple',
        ingredient: {
          type: 'mm:item',
          item: outputItem,
          count: 1
        }
      });
  }

// Allthemodium — template custom
  const allthemodiumTemplate = 'allthemodium:allthemodium_upgrade_smithing_template';

  createSmithing('minecraft:netherite_hoe', 'allthemodium:allthemodium_hoe', allthemodiumTemplate);
  createSmithing('minecraft:netherite_shovel', 'allthemodium:allthemodium_shovel', allthemodiumTemplate);
  createSmithing('minecraft:netherite_pickaxe', 'allthemodium:allthemodium_pickaxe', allthemodiumTemplate);
  createSmithing('minecraft:netherite_sword', 'allthemodium:allthemodium_sword', allthemodiumTemplate);
  createSmithing('minecraft:netherite_chestplate', 'allthemodium:allthemodium_chestplate', allthemodiumTemplate);
  createSmithing('minecraft:netherite_boots', 'allthemodium:allthemodium_boots', allthemodiumTemplate);
  createSmithing('minecraft:netherite_axe', 'allthemodium:allthemodium_axe', allthemodiumTemplate);
  createSmithing('minecraft:netherite_helmet', 'allthemodium:allthemodium_helmet', allthemodiumTemplate);
  createSmithing('minecraft:netherite_leggings', 'allthemodium:allthemodium_leggings', allthemodiumTemplate);
});
MMEvents.createProcesses(event => {
  function createSmithing(inputItem, outputItem, templateItem) {
    if (!templateItem) {
      templateItem = 'minecraft:netherite_upgrade_smithing_template';
    }

    event
      .create(`mm:smithing/${outputItem.replace(':', '_')}`)
      .structureId('mm:smithing_structure')
      .ticks(4)
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: inputItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: 'armorplus:infused_frost_crystal',
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:item',
          item: templateItem,
          count: 1
        }
      })
      .input({
        type: 'mm:input/consume',
        ingredient: {
          type: 'mm:energy',
          amount: 1000
        }
      })
      .output({
        type: 'mm:output/simple',
        ingredient: {
          type: 'mm:item',
          item: outputItem,
          count: 1
        }
      });
  }

// Allthemodium — template custom
  const allthemodiumTemplate = 'minecraft:lava_bucket';

  createSmithing('armorplus:infused_lava_crystal', 'armorplus:infused_frost_lava_crystal', allthemodiumTemplate);
  createSmithing('armorplus:infused_frost_crystal', 'armorplus:infused_frost_lava_crystal', allthemodiumTemplate);
;
});


  