ServerEvents.recipes(event => {
  // =========================================
  // Create Block/Item Recipes
  // =========================================

  // Item Filter
  event
    .shaped("create:filter", [
      "ABA"
    ], 
    {
      A: "#forge:nuggets/zinc",
      B: "undergarden:mushroom_veil",
    })
    .id("create:crafting/kinetics/filter");

  // Attribute Filter
  event
    .shaped("create:attribute_filter", [
      "ABA"
    ], 
    {
      A: "call_of_yucutan:ancient_gold_nugget",
      B: "undergarden:mushroom_veil",
    })
    .id("create:crafting/kinetics/attribute_filter");

  // Remove "standard" recipe for Electron Tube
  event.remove({ id: "create:crafting/materials/electron_tube" });

  // Remove "standard" recipe for Precision Mechanism
  event.remove({ id: "create:sequenced_assembly/precision_mechanism" });

  // Thermal Press Recipes for Cogs
  event.recipes.thermal
    .press("create:cogwheel", ["#minecraft:planks", "thermal:press_gear_die"])
    .energy(1000);
  event.recipes.thermal
    .press("create:large_cogwheel", [
      "#minecraft:logs",
      "thermal:press_gear_die",
    ])
    .energy(1000);
  
// Replacing saplings with flax or sawdust for pulp
  event.replaceInput(
    {id: "create:mixing/cardboard_pulp"},
    "#create:pulpifiable",
    ["minecraft:bamboo", "thermal:sawdust", "supplementaries:flax"]
  );

// Stock Ticker (with Vibrant Vault support)
  event
    .shaped("create:stock_ticker", [
      " A ", 
      "BCD", 
      " E "
    ], 
    {
      A: "display_case:display_case",
      B: "create_new_age:copper_wire",
      C: "sophisticatedstorage:packing_tape",
      D: "create:steam_whistle",
      E: "#create_vibrant_vaults:stock_links"
    })
    .id("create:crafting/logistics/stock_ticker");


// Packager
  event
    .shaped("create:packager", [
      "ABA", 
      "CDE", 
      "AFA"
    ], 
    {
      A: "#forge:ingots/tin",
      B: "create_dd:inductive_mechanism",
      C: "easy_villagers:villager",
      D: "wares:delivery_table",
      E: "wares:cardboard_box",
      F: "supplementaries:cog_block"
    })
    .id("create:crafting/logistics/packager");


// Factory Gauge
  event
    .shaped("4x create:factory_gauge", [
      "A", 
      "B", 
      "C"
    ], 
    {
      A: "create:placard",
      B: "create_dd:calculation_mechanism",
      C: "create:redstone_link"
    })
    .id("create:crafting/logistics/factory_gauge");   
    

// Transmitter
  event
    .shaped("create:transmitter", [
      " A ", 
      "BBB"
    ], 
    {
      A: "minecraft:redstone_torch",
      B: "create_new_age:copper_wire"
    })
    .id("create:crafting/materials/transmitter");       


  // Replacing Brass Sheets and Ingots with Ancient Gold

  event.replaceInput(
    {},
    "create:brass_sheet",
    "call_of_yucutan:ancient_gold_sheet"
  );
  event.replaceInput(
    {},
    "create:brass_ingot",
    "call_of_yucutan:ancient_gold_ingot"
  );
  event.replaceInput(
    {},
    "create:brass_block",
    "call_of_yucutan:ancient_gold"
  );
  event.replaceInput(
    {},
    "create:brass_nugget",
    "call_of_yucutan:ancient_gold_nugget"
  );
  event.replaceInput(
    {},
    "create:brass_ingot",
    "call_of_yucutan:ancient_gold_ingot"
  );

  // Replacing Stripped Wood with Frosted Gingerbread Blocks (Brass Casing recipe)
  event.remove({
    id: "create:item_application/brass_casing_from_log_using_deployer",
  });
  event.remove({ id: "create:item_application/brass_casing_from_log" });
  event.replaceInput(
    { output: "create:brass_casing" },
    ["#forge:stripped_wood", "#forge:stripped_logs"],
    "alexscaves:frosted_gingerbread_block"
  );

  // Replacing Copper Sheets and Ingots with Caramel
  event.replaceInput(
    [{ output: "create:copper_casing" }],
    "#forge:ingots/copper",
    "alexscaves:caramel"
  );
  event.replaceInput(
    [{ mod: "create" }],
    "#forge:plates/copper",
    "alexscaves:caramel_sheet"
  );

  event.replaceInput(
    [{ output: "create:fluid_pipe" }],
    "#forge:ingots/copper",
    "#rats:tubes"
  );

  // Replacing Stripped Wood with Crabbers Delight stuff (Copper Casing recipe)
  event.replaceInput(
    { output: "create:copper_casing" },
    ["#forge:stripped_wood", "#forge:stripped_logs"],
    [
      /^crabbersdelight:.*barrel$/,
      "crabbersdelight:nautilus_shell_block",
      "ecologics:seashell_block",
    ]
  );

  // Removing Early Game Andesite Alloy Recipes
  event.remove({ id: "create:crafting/materials/andesite_alloy_from_zinc" });
  event.remove({ id: "create:mixing/andesite_alloy_from_zinc" });
  event.remove({ id: "create_dd:industrial_iron/andesite_alloy" });
  event.remove({ id: "create_dd:industrial_iron/andesite_alloy_mixing" });
  event.replaceInput(
    { output: "create:andesite_alloy" },
    ["#forge:nuggets/iron"],
    "#forge:nuggets/tin"
  );

  // Windmill Sail
  event
    .shaped("4x create:white_sail", [
      "AB", 
      "BC"
    ], 
    {
      A: "the_bumblezone:windy_air",
      B: "#forge:rods/wooden",
      C: "create:andesite_alloy",
    })
    .id("create:crafting/kinetics/white_sail");

  // Windmill Bearing
  event
    .shaped("create:windmill_bearing", [
      "ABA", 
      "CDC", 
      "AEA"
    ], 
    {
      A: "the_bumblezone:windy_air",
      B: "#minecraft:wooden_slabs",
      C: "supplementaries:wind_vane",
      D: "#forge:stone",
      E: "create:shaft",
    })
    .id("create:crafting/kinetics/windmill_bearing");

  // Steam Engine
  event.replaceInput(
    { output: "create:steam_engine" },
    ["#forge:storage_blocks/copper"],
    "#forge:storage_blocks/constantan"
  );

  // Large Water Wheel
  event
    .shaped("create:large_water_wheel", [
      "AAA", 
      "ABA", 
      "AAA"
    ], 
    {
      A: "#decorative_blocks:palisades",
      B: "minecraft:conduit",
    })
    .id("create:crafting/kinetics/large_water_wheel");

    event
    .shaped("create:large_water_wheel", [
      "AAA", 
      "ABA", 
      "AAA"
    ], 
    {
      A: 'minecraft:nautilus_shell',
      B: 'create:water_wheel',
    })
    .id("create:crafting/kinetics/large_water_wheel2");  




    // Small Water Wheel
  event
  .shaped("create:water_wheel", [
    "AAA", 
    "ABA", 
    "AAA"
  ], 
  {
    A: "#decorative_blocks:palisades",
    B: "minecraft:heart_of_the_sea",
  })
  .id("create:crafting/kinetics/water_wheel");

  // =========================================
  // Create Diving Suit Recipes
  // =========================================

  let seqDiving = (Output, Input, Deploy1, Deploy2, TransItem) => {
    event.recipes.create
      .sequenced_assembly(Output, Input, [
        event.recipes.create.deploying(TransItem, [TransItem, Deploy1]),
        event.recipes.create.deploying(TransItem, [TransItem, Deploy2]),
        event.recipes.create.pressing(TransItem, TransItem),
      ])
      .transitionalItem(TransItem)
      .loops(1)
      .id(`create:crafting/appliances/${Output.slice(7)}`);
  };
  seqDiving(
    "create:copper_diving_helmet",
    "create_sa:copper_helmet",
    "minecraft:cyan_stained_glass_pane",
    "create:fluid_pipe",
    "create:incomplete_copper_diving_helmet"
  );
  seqDiving(
    "create:copper_diving_boots",
    "create_sa:copper_boots",
    "alexscaves:cinder_brick",
    "alexscaves:cinder_brick",
    "create:incomplete_copper_diving_boots"
  );
  seqDiving(
    "create:copper_backtank",
    "create_sa:copper_chestplate",
    "create_sa:large_filling_tank",
    "create:mechanical_pump",
    "create:incomplete_copper_backtank"
  );

  // =========================================
  // Create Machines
  // =========================================

  // Deployer uses Rats paw
  event.replaceInput(
    { output: "create:deployer" },
    "create:brass_hand",
    ["rats:rat_paw", "crabbersdelight:crab_claw"]
  );

// Mechanical Crafter needs dino eggs
event
.shaped("3x create:mechanical_crafter", [
  " A ", 
  "BCB", 
  " D "
], 
{
  A: "create:electron_tube",
  B: "alexscaves:subterranodon_egg",
  C: "create:brass_casing",
  D: "minecraft:crafting_table"
})
.id("create:crafting/kinetics/mechanical_crafter");  

  // Crushing Wheels
  event.recipes.create
    .mechanical_crafting("2x create:crushing_wheel", [
        " AAA ", 
        "AABAA", 
        "ABCBA", 
        "AABAA", 
        " AAA "
    ],
    {
        A: "#alexscaves:rock_candies",
        B: "alexscaves:sweet_tooth",
        C: "create:encased_chain_drive",
    })
    .id("create:mechanical_crafting/crushing_wheel");

  // =========================================
  // Butchercraft Automation
  // =========================================

  event.recipes.create.cutting(
    ["butchersdelight:deadcowblockskinned", "butchersdelight:cow_hide"],
    "butchersdelight:dead_cow"
  );
  event.recipes.create.cutting(
    [
      "butchersdelight:skullcow",
      "minecraft:bone",
      Item.of("3x minecraft:beef").withChance(0.85),
      Item.of("3x qualitycrops:beef_iron").withChance(0.45),
      Item.of("3x qualitycrops:beef_gold").withChance(0.3),
      Item.of("3x qualitycrops:beef_diamond").withChance(0.15),
    ],
    "butchersdelight:deadcowblockskinned"
  );
  event.recipes.create.cutting(
    ["butchersdelight:deadsheepskinnedblock", "butchersdelight:sheephide"],
    "butchersdelight:deadsheep"
  );
  event.recipes.create.cutting(
    [
      "minecraft:bone",
      Item.of("4x minecraft:mutton").withChance(0.85),
      Item.of("3x qualitycrops:mutton_iron").withChance(0.45),
      Item.of("3x qualitycrops:mutton_gold").withChance(0.3),
      Item.of("3x qualitycrops:mutton_diamond").withChance(0.15),
    ],
    "butchersdelight:deadsheepskinnedblock"
  );
  event.recipes.create.cutting(
    ["butchersdelight:deadgoatskinnedblock", "butchersdelight:goat_fur"],
    "butchersdelight:deadgoat"
  );
  event.recipes.create.cutting(
    [
      "minecraft:bone",
      Item.of("4x minecraft:mutton").withChance(0.85),
      Item.of("3x qualitycrops:mutton_iron").withChance(0.45),
      Item.of("3x qualitycrops:mutton_gold").withChance(0.3),
      Item.of("3x qualitycrops:mutton_diamond").withChance(0.15),
    ],
    "butchersdelight:deadgoatskinnedblock"
  );
  event.recipes.create.cutting(
    [
      "butchersdelight:deadllamaskinnedblock",
      "butchersdelight:goat_fur",
      "minecraft:leather",
    ],
    "butchersdelight:deadllama"
  );
  event.recipes.create.cutting(
    [
      "minecraft:bone",
      Item.of("4x minecraft:mutton").withChance(0.85),
      Item.of("3x qualitycrops:mutton_iron").withChance(0.45),
      Item.of("3x qualitycrops:mutton_gold").withChance(0.3),
      Item.of("3x qualitycrops:mutton_diamond").withChance(0.15),
    ],
    "butchersdelight:deadllamaskinnedblock"
  );
  event.recipes.create.cutting(
    ["butchersdelight:deadstriderblockskinned", "6x minecraft:string"],
    "butchersdelight:deadstrider"
  );
  event.recipes.create.cutting(
    ["2x mynethersdelight:strider_slice", "minecraft:basalt"],
    "butchersdelight:deadstriderblockskinned"
  );
  event.recipes.create.cutting(
    [
      "butchersdelight:deadrabiitskinnedblock",
      "minecraft:rabbit_hide",
      Item.of("minecraft:rabbit_foot").withChance(0.05),
    ],
    "butchersdelight:deadrabbitbrown"
  );
  event.recipes.create.cutting(
    [
      Item.of("minecraft:rabbit"),
      Item.of("2x qualitycrops:rabbit_iron").withChance(0.3),
      Item.of("2x qualitycrops:rabbit_gold").withChance(0.2),
      Item.of("2x qualitycrops:rabbit_diamond").withChance(0.1),
    ],
    "butchersdelight:deadrabiitskinnedblock"
  );
  event.recipes.create.cutting(
    ["butchersdelight:deadchickenblockskinned", "2x minecraft:feather"],
    "butchersdelight:deadchiken"
  );
  event.recipes.create.cutting(
    [
      Item.of("minecraft:chicken"),
      Item.of("2x qualitycrops:chicken_iron").withChance(0.3),
      Item.of("2x qualitycrops:chicken_gold").withChance(0.2),
      Item.of("2x qualitycrops:chicken_diamond").withChance(0.1),
    ],
    "butchersdelight:deadchickenblockskinned"
  );
  event.recipes.create.cutting(
    [
      "minecraft:bone",
      Item.of("2x minecraft:porkchop").withChance(0.85),
      Item.of("2x qualitycrops:porkchop_iron").withChance(0.3),
      Item.of("2x qualitycrops:porkchop_gold").withChance(0.2),
      Item.of("2x qualitycrops:porkchop_diamond").withChance(0.1),
      Item.of("farmersdelight:ham"),
      Item.of("qualitysdelight:ham_iron").withChance(0.15),
      Item.of("qualitysdelight:ham_gold").withChance(0.1),
      Item.of("qualitysdelight:ham_diamond").withChance(0.05),
    ],
    "butchersdelight:deadpig"
  );
  event.recipes.create.cutting(
    [
      "mynethersdelight:hoglin_hide",
      "mynethersdelight:hoglin_loin",
      "minecraft:bone",
      Item.of("2x minecraft:porkchop").withChance(0.85),
      Item.of("2x qualitycrops:porkchop_iron").withChance(0.3),
      Item.of("2x qualitycrops:porkchop_gold").withChance(0.2),
      Item.of("2x qualitycrops:porkchop_diamond").withChance(0.1),
      Item.of("farmersdelight:ham"),
      Item.of("qualitysdelight:ham_iron").withChance(0.15),
      Item.of("qualitysdelight:ham_gold").withChance(0.1),
      Item.of("qualitysdelight:ham_diamond").withChance(0.05),
    ],
    "butchersdelight:deadhoglin"
  );
  event.recipes.create.cutting(
    [
      "8x minecraft:stick",
      Item.of("thermal:sawdust").withChance(0.85),
      Item.of("2x thermal:sawdust").withChance(0.15),
    ],
    "#minecraft:planks"
  );
  event.recipes.create.emptying([Fluid.of("undergarden:virulent_mix_source", 1000),'minecraft:bucket'],'undergarden:virulent_mix_bucket');
});