// These are all the recipe changes for the Reimagined Modpack. They'll be categorized by group.

// Opening recipe commands.

ServerEvents.recipes(event => {
	
// Recipe changes for tom's simple storage.

event.remove({ output: 'toms_storage:ts.inventory_connector' })
event.remove({ output: 'toms_storage:ts.crafting_terminal' })
event.remove({ output: 'toms_storage:ts.storage_terminal' })

event.shaped(
  Item.of('toms_storage:ts.inventory_connector', 1), // arg 1: output
  [
    'A B',
    ' C ', // arg 2: the shape (array of strings)
    'B A'
  ],
  {
    A: 'minecraft:copper_ingot',
    B: 'create:andesite_casing',  //arg 3: the mapping object
    C: 'minecraft:chest'
  }
)

event.shaped(
  Item.of('toms_storage:ts.storage_terminal', 1), // arg 1: output
  [
    'A B',
    ' C ', // arg 2: the shape (array of strings)
    'B A'
  ],
  {
    A: 'create:andesite_alloy',
    B: 'minecraft:redstone',  //arg 3: the mapping object
    C: 'create:andesite_casing'
  }
)

event.shaped(
  Item.of('toms_storage:ts.crafting_terminal', 1), // arg 1: output
  [
    'A B',
    ' C ', // arg 2: the shape (array of strings)
    'B A'
  ],
  {
    A: 'minecraft:copper_ingot',
    B: 'minecraft:crafting_table',  //arg 3: the mapping object
    C: 'toms_storage:ts.storage_terminal'
  }
)
// Recipe changes for backpacked

event.shaped(
  Item.of('backpacked:backpack', 1), // arg 1: output
  [
    'ACA',
    ' B ', // arg 2: the shape (array of strings)
    'A A'
  ],
  {
    A: 'minecraft:leather',
    B: 'minecraft:chest',  //arg 3: the mapping object
    C: 'create:iron_sheet'
  }
)

// Recipe changes for create

event.shapeless(
  Item.of('create:mechanical_press', 1), // arg 1: output
  [
    'minecraft:andesite',
    'create:andesite_casing' 	       // arg 2: the array of inputs
  ]
)

// Recipe changes for iron and gold, requiring sheets instead of ingots.

event.replaceInput(
  {not: {mod: 'create'}, input: 'iron_ingot'}, // Arg 1: the filter
  'minecraft:iron_ingot',            // Arg 2: the item to replace
  'create:iron_sheet'         // Arg 3: the item to replace it with
  // Note: tagged fluid ingredients do not work on Fabric, but tagged items do.
)

// Add back iron and golden sheet recipe after removing them above.

event.recipes.create.compacting('create:iron_sheet', 'minecraft:iron_ingot')
event.recipes.create.compacting('create:golden_sheet', 'minecraft:gold_ingot')

// Recipe changes to diamond armor, making you upgrade iron in a crafting table.

event.remove({ output: 'minecraft:diamond_helmet' })
event.remove({ output: 'minecraft:diamond_chestplate' })
event.remove({ output: 'minecraft:diamond_leggings' })
event.remove({ output: 'minecraft:diamond_boots' })

event.shapeless(
  Item.of('minecraft:diamond_helmet', 1), // arg 1: output
  [
    'minecraft:iron_helmet',
    '5x minecraft:diamond' 	       // arg 2: the array of inputs
  ]
)

event.shapeless(
  Item.of('minecraft:diamond_chestplate', 1), // arg 1: output
  [
    'minecraft:iron_chestplate',
    '8x minecraft:diamond' 	       // arg 2: the array of inputs
  ]
)

event.shapeless(
  Item.of('minecraft:diamond_leggings', 1), // arg 1: output
  [
    'minecraft:iron_chestplate',
    '7x minecraft:diamond' 	       // arg 2: the array of inputs
  ]
)

event.shapeless(
  Item.of('minecraft:diamond_boots', 1), // arg 1: output
  [
    'minecraft:iron_boots',
    '4x minecraft:diamond' 	       // arg 2: the array of inputs
  ]
)

// Recipe changes for aeternium armor, requiring you to mix gravitite and upgrade netherite. Doesn't work without Create installed.

event.remove({ output: 'betterend:aeternium_ingot' })
event.remove({ output: 'betterend:aeternium_helmet' })
event.remove({ output: 'betterend:aeternium_chestplate' })
event.remove({ output: 'betterend:aeternium_boots' })
event.remove({ output: 'betterend:aeternium_leggings' })

event.recipes.create.mixing('betterend:aeternium_ingot', ['aether:enchanted_gravitite', 'betterend:terminite_ingot']).heated()

event.smithing(
  'betterend:aeternium_helmet',                     // arg 1: output
  'betterend:aeternium_upgrade_smithing_template', // arg 2: the smithing template
  'aether:gravitite_helmet',                          // arg 3: the item to be upgraded
  'betterend:aeternium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'betterend:aeternium_chestplate',                     // arg 1: output
  'betterend:aeternium_upgrade_smithing_template', // arg 2: the smithing template
  'aether:gravitite_chestplate',                          // arg 3: the item to be upgraded
  'betterend:aeternium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'betterend:aeternium_boots',                     // arg 1: output
  'betterend:aeternium_upgrade_smithing_template', // arg 2: the smithing template
  'aether:gravitite_leggings',                          // arg 3: the item to be upgraded
  'betterend:aeternium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'betterend:aeternium_leggings',                     // arg 1: output
  'betterend:aeternium_upgrade_smithing_template', // arg 2: the smithing template
  'aether:gravitite_boots',                          // arg 3: the item to be upgraded
  'betterend:aeternium_ingot'                            // arg 4: the upgrade item
)

// Recipe changes for ignitium and cursium armor, requiring you to upgrade aeternium.

event.remove({ output: 'cataclysm:ignitium_helmet' })
event.remove({ output: 'cataclysm:ignitium_chestplate' })
event.remove({ output: 'cataclysm:ignitium_boots' })
event.remove({ output: 'cataclysm:ignitium_leggings' })
event.remove({ output: 'cataclysm:cursium_helmet' })
event.remove({ output: 'cataclysm:cursium_chestplate' })
event.remove({ output: 'cataclysm:cursium_boots' })
event.remove({ output: 'cataclysm:cursium_leggings' })

event.smithing(
  'cataclysm:ignitium_helmet',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_helmet',                          // arg 3: the item to be upgraded
  'cataclysm:ignitium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'cataclysm:ignitium_chestplate',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_chestplate',                          // arg 3: the item to be upgraded
  'cataclysm:ignitium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'cataclysm:ignitium_boots',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_leggings',                          // arg 3: the item to be upgraded
  'cataclysm:ignitium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'cataclysm:ignitium_leggings',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_boots',                          // arg 3: the item to be upgraded
  'cataclysm:ignitium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'cataclysm:cursium_helmet',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_helmet',                          // arg 3: the item to be upgraded
  'cataclysm:cursium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'cataclysm:cursium_chestplate',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_chestplate',                          // arg 3: the item to be upgraded
  'cataclysm:cursium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'cataclysm:cursium_boots',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_leggings',                          // arg 3: the item to be upgraded
  'cataclysm:cursium_ingot'                            // arg 4: the upgrade item
)

event.smithing(
  'cataclysm:cursium_leggings',                     // arg 1: output
  'minecraft:netherite_upgrade_smithing_template', // arg 2: the smithing template
  'betterend:aeternium_boots',                          // arg 3: the item to be upgraded
  'cataclysm:cursium_ingot'                            // arg 4: the upgrade item
)

//Consolidate ropes to supplementaries rope.

event.remove({ output: 'farmersdelight:rope' })
event.remove({ output: 'quark:rope' })

event.replaceInput(
  { input: 'farmersdelight:rope' }, // Arg 1: the filter
  'farmersdelight:rope',            // Arg 2: the item to replace
  'supplementaries:rope'         // Arg 3: the item to replace it with
  // Note: tagged fluid ingredients do not work on Fabric, but tagged items do.
)

event.replaceInput(
  { input: 'quark:rope' }, // Arg 1: the filter
  'quark:rope',            // Arg 2: the item to replace
  'supplementaries:rope'         // Arg 3: the item to replace it with
  // Note: tagged fluid ingredients do not work on Fabric, but tagged items do.
)

//Craft supplementaries rope with straw. (Flax is removed).

event.remove({ output: 'supplementaries:rope' })

event.shaped(
  Item.of('supplementaries:rope', 1), // arg 1: output
  [
    ' A ',
    ' A ', // arg 2: the shape (array of strings)
    ' A '
  ],
  {
    A: 'farmersdelight:straw'
  }
)

//Add recipe for nametags.

event.shaped(
  Item.of('minecraft:name_tag', 1), // arg 1: output
  [
    ' B ',
    ' B ', // arg 2: the shape (array of strings)
    ' A '
  ],
  {
    A: 'minecraft:paper',
	B: 'create:iron_sheet'
  }
)

//Smelt rotten flesh into leather.

event.smoking('minecraft:leather', 'minecraft:rotten_flesh').xp(0.15)

event.campfireCooking('minecraft:leather', 'minecraft:rotten_flesh', 0.15, 20)

//Iron's spells recipes.

event.recipes.create.mixing('irons_spellbooks:arcane_essence', ['minecraft:lapis_lazuli', 'minecraft:amethyst_shard'])
event.recipes.create.mixing('irons_spellbooks:arcane_debris', ['irons_spellbooks:cinder_essence', 'minecraft:amethyst_block']).heated()
event.recipes.create.mixing('irons_spellbooks:cinder_essence', ['irons_spellbooks:arcane_essence', 'minecraft:blaze_rod']).heated()
event.recipes.create.compacting('irons_spellbooks:blank_rune', 'minecraft:chiseled_deepslate')
event.recipes.create.compacting('irons_spellbooks:lightning_bottle', 'minecraft:gunpowder')
event.recipes.create.mixing('irons_spellbooks:frozen_bone', ['minecraft:bone', 'minecraft:ice'])
event.recipes.create.mixing('irons_spellbooks:hogskin', ['minecraft:leather', 'minecraft:porkchop']).heated()
event.recipes.create.mixing('irons_spellbooks:arcane_essence', ['minecraft:lapis_lazuli', 'minecraft:amethyst_shard'])
event.recipes.create.mixing('irons_spellbooks:dragonskin', ['minecraft:leather', 'betterend:terminite_ingot']).superheated()
event.recipes.create.mixing('irons_spellbooks:permafrost_shard', ['minecraft:amethyst_shard', 'irons_spellbooks:frozen_bone'])
event.recipes.create.mixing('minecraft:phantom_membrane', ['minecraft:leather', 'minecraft:ender_pearl'])
event.recipes.create.mixing('minecraft:pufferfish', ['minecraft:raw_cod', 'minecraft:cactus'])
event.recipes.create.mixing('minecraft:poisonous_potato', ['minecraft:potato', 'minecraft:pufferfish'])

//Closing brackets.

})