ServerEvents.recipes((event) => {
  // Qualitys Delight Crop Downgrading
  let veggieDowngrade = ["cabbage_leaf", "cabbage", "onion", "rice", "tomato"];
  veggieDowngrade.forEach((veggie) => {
    event
      .shapeless(`farmersdelight:${veggie}`, `qualitysdelight:${veggie}_iron`)
      .id(`farmersdelight:${veggie}_from_${veggie}_iron`);
    event
      .shapeless(
        `qualitysdelight:${veggie}_iron`,
        `qualitysdelight:${veggie}_gold`
      )
      .id(`qualitysdelight:${veggie}_iron_from_${veggie}_gold`);
    event
      .shapeless(
        `qualitysdelight:${veggie}_gold`,
        `qualitysdelight:${veggie}_diamond`
      )
      .id(`qualitysdelight:${veggie}_gold_from_${veggie}_diamond`);
  });

  // Qualitys Delight Meat Downgrading
  let meatDowngrade = [
    "fried_egg",
    "minced_beef",
    "beef_patty",
    "bacon",
    "cooked_bacon",
    "cod_slice",
    "cooked_cod_slice",
    "salmon_slice",
    "cooked_salmon_slice",
    "mutton_chops",
    "cooked_mutton_chops",
    "ham",
    "smoked_ham",
    "chicken_cuts",
    "cooked_chicken_cuts",
  ];
  meatDowngrade.forEach((meat) => {
    event
      .shapeless(`farmersdelight:${meat}`, `qualitysdelight:${meat}_iron`)
      .id(`farmersdelight:${meat}_from_${meat}_iron`);
    event
      .shapeless(`qualitysdelight:${meat}_iron`, `qualitysdelight:${meat}_gold`)
      .id(`qualitysdelight:${meat}_iron_from_${meat}_gold`);
    event
      .shapeless(
        `qualitysdelight:${meat}_gold`,
        `qualitysdelight:${meat}_diamond`
      )
      .id(`qualitysdelight:${meat}_gold_from_${meat}_diamond`);
  });

  // Qualitys Delight Fish Downgrading
  let fishDowngrade = [
    "guardian",
    "tentacles",
    "cut_tentacles",
    "guardian_tail",
    "cooked_guardian_tail",
    "elder_guardian_slab",
    "elder_guardian_slice",
    "cooked_elder_guardian_slice",
    "fugu_slice",
  ];
  fishDowngrade.forEach((fish) => {
    event
      .shapeless(`oceansdelight:${fish}`, `qualitysdelight:${fish}_iron`)
      .id(`oceansdelight:${fish}_from_${fish}_iron`);
    event
      .shapeless(`qualitysdelight:${fish}_iron`, `qualitysdelight:${fish}_gold`)
      .id(`qualitysdelight:${fish}_iron_from_${fish}_gold`);
    event
      .shapeless(
        `qualitysdelight:${fish}_gold`,
        `qualitysdelight:${fish}_diamond`
      )
      .id(`qualitysdelight:${fish}_gold_from_${fish}_diamond`);
  });

  // Qualitys Delight Shellfish Downgrading
  let shellfishDowngrade = [
    "clam",
    "crab",
    "cooked_crab",
    "clawster",
    "cooked_clawster",
    "shrimp",
    "cooked_shrimp",
    "raw_clam_meat",
    "cooked_clam_meat",
    "cooked_tropical_fish",
    "tropical_fish_slice",
    "cooked_tropical_fish_slice",
  ];
  shellfishDowngrade.forEach((shellfish) => {
    event
      .shapeless(
        `crabbersdelight:${shellfish}`,
        `qualitysdelight:${shellfish}_iron`
      )
      .id(`crabbersdelight:${shellfish}_from_${shellfish}_iron`);
    event
      .shapeless(
        `qualitysdelight:${shellfish}_iron`,
        `qualitysdelight:${shellfish}_gold`
      )
      .id(`qualitysdelight:${shellfish}_iron_from_${shellfish}_gold`);
    event
      .shapeless(
        `qualitysdelight:${shellfish}_gold`,
        `qualitysdelight:${shellfish}_diamond`
      )
      .id(`qualitysdelight:${shellfish}_gold_from_${shellfish}_diamond`);
  });

  // Placing single item in an array so I can passive aggressively declare this variable.
  // ...because "crabbersdelight:crab_legs" but "qualitysdelight:crab_leg_*" and 400 lines of datapack console errors
  // At least this time it works D:<
  let myHeadHurtsFromQualitysDelightsBrokenCode = ["crab_leg"];
  myHeadHurtsFromQualitysDelightsBrokenCode.forEach((headache) => {
    event
      .shapeless(
        `crabbersdelight:${headache}` + "s",
        `qualitysdelight:${headache}_iron`
      )
      .id(`crabbersdelight:${headache}s_from_${headache}_iron`);
    event
      .shapeless(
        `qualitysdelight:${headache}_iron`,
        `qualitysdelight:${headache}_gold`
      )
      .id(`qualitysdelight:${headache}_iron_from_${headache}_gold`);
    event
      .shapeless(
        `qualitysdelight:${headache}_gold`,
        `qualitysdelight:${headache}_diamond`
      )
      .id(`qualitysdelight:${headache}_gold_from_${headache}_diamond`);
  });

  let riceProcessing = (input, output) => {
    event.recipes.create.crushing([output, "farmersdelight:straw"], input);
    event.recipes.create.milling([output, "farmersdelight:straw"], input);
    event.recipes.farmersdelight.cutting(
      input,
      "#farmersdelight:tools/knives",
      [
        // results
        output,
        "farmersdelight:straw",
      ]
    );
  };
  riceProcessing(
    "qualitysdelight:rice_panicle_diamond",
    "qualitysdelight:rice_diamond"
  );
  riceProcessing(
    "qualitysdelight:rice_panicle_gold",
    "qualitysdelight:rice_gold"
  );
  riceProcessing(
    "qualitysdelight:rice_panicle_iron",
    "qualitysdelight:rice_iron"
  );

// Various Meal Fixes

let qualityMealranks = [
  "diamond",
  "gold",
  "iron"
]

qualityMealranks.forEach((quality) => {
// Bacon Sandwich
event.replaceInput(
  { id: `qualitysdelight:bacon_sandwich_${quality}` },
  `qualitysdelight:bacon_${quality}`, 
  `qualitysdelight:cooked_bacon_${quality}` 
);

event.replaceInput(
  { id: `qualitysdelight:bacon_and_eggs_${quality}` },
  `qualitysdelight:bacon_${quality}`, 
  `qualitysdelight:cooked_bacon_${quality}` 
);

event.replaceInput(
  { id: `qualitysdelight:honey_glazed_ham_block_${quality}` },
  `qualitysdelight:ham_${quality}`, 
  `qualitysdelight:smoked_ham_${quality}` 
);

event.replaceInput(
  { id: `qualitysdelight:honey_glazed_ham_block_${quality}` },
  `minecraft:sweet_berries`, 
  `qualitycrops:sweet_berries_${quality}` 
);



})

});
