ServerEvents.recipes((event) => {
  // Quality Crops dough using egg (to mimic FD recipe)
  event.shapeless("qualitycrops:dough", [
    "#forge:eggs",
    "3x #forge:crops/wheat",
  ]);

  // Bunch of Sugar (and paper) Fixes
  event
    .shapeless("qualitycrops:sugar_diamond", [
      "qualitycrops:sugar_cane_diamond",
    ])
    .id("qualitycrops:sugar_diamond_from_sugar_cane_diamond");
  event
    .shapeless("qualitycrops:sugar_gold", ["qualitycrops:sugar_cane_gold"])
    .id("qualitycrops:sugar_gold_from_sugar_cane_gold");
  event.remove({ id: "qualitycrops:sugar_cane_gold_from_sugar_cane_diamond" });
  event.remove({ id: "qualitycrops:sugar_cane_iron_from_sugar_cane_gold" });
  event.replaceInput({ id: "minecraft:paper" }, "minecraft:sugar_cane", [
    "minecraft:sugar_cane",
    "qualitycrops:sugar_cane_iron",
    "qualitycrops:sugar_cane_gold",
    "qualitycrops:sugar_cane_diamond",
  ]);
  event.replaceInput(
    { id: "create:pressing/sugar_cane" },
    "minecraft:sugar_cane",
    [
      "minecraft:sugar_cane",
      "qualitycrops:sugar_cane_iron",
      "qualitycrops:sugar_cane_gold",
      "qualitycrops:sugar_cane_diamond",
    ]
  );

  let sugarProcessing = (input, chance) => {
    event.recipes.create.crushing(
      ["2x minecraft:sugar", Item.of("minecraft:sugar").withChance(chance)],
      input
    );
    event.recipes.create.milling(
      ["2x minecraft:sugar", Item.of("minecraft:sugar").withChance(chance)],
      input
    );
  };
  sugarProcessing("qualitycrops:sugar_cane_iron", 0.25);
  sugarProcessing("qualitycrops:sugar_cane_gold", 0.5);
  sugarProcessing("qualitycrops:sugar_cane_diamond", 0.75);

  // Wheat to Flour
  let flourProcessing = (input, chance) => {
    event.recipes.create.crushing(
      [
        "create:wheat_flour",
        Item.of("2x create:wheat_flour").withChance(chance),
        Item.of("minecraft:wheat_seeds").withChance(0.25),
      ],
      input
    );
    event.recipes.create.milling(
      [
        "create:wheat_flour",
        Item.of("2x create:wheat_flour").withChance(chance),
        Item.of("minecraft:wheat_seeds").withChance(0.25),
      ],
      input
    );
  };
  flourProcessing("qualitycrops:wheat_iron", 0.4);
  flourProcessing("qualitycrops:wheat_gold", 0.6);
  flourProcessing("qualitycrops:wheat_diamond", 0.8);

  // Cocoa Clankin
  let cocoaProcessing = (input, chance) => {
    event.recipes.create.pressing(
      [
        "create_confectionery:crushed_cocoa",
        Item.of("create_confectionery:crushed_cocoa").withChance(chance),
      ],
      input
    );
  };
  cocoaProcessing("qualitycrops:cocoa_beans_iron", 0.25);
  cocoaProcessing("qualitycrops:cocoa_beans_gold", 0.5);
  cocoaProcessing("qualitycrops:cocoa_beans_diamond", 0.75);
});
