events.listen("recipes", function (e) {
  function craftColossal(lieutenentDuCon, tankCatalyseur, idcraft) {
    e.remove({ id: idcraft });

    e.custom({
      result: {
        item: idcraft,
      },
      pattern: ["AB ", "   ", "   "],
      type: "minecraft:crafting_shaped",
      key: {
        A: { item: lieutenentDuCon },
        B: { item: tankCatalyseur },
      },
    });
  }

  //craft colossal
  craftColossal(
    "colossalchests:chest_wall_wood",
    "dankstorage:dank_1",
    "colossalchests:colossal_chest_wood"
  );
  craftColossal(
    "colossalchests:chest_wall_copper",
    "dankstorage:dank_2",
    "colossalchests:colossal_chest_copper"
  );
  craftColossal(
    "colossalchests:chest_wall_silver",
    "dankstorage:dank_4",
    "colossalchests:colossal_chest_silver"
  );
  craftColossal(
    "colossalchests:chest_wall_gold",
    "dankstorage:dank_5",
    "colossalchests:colossal_chest_gold"
  );
  craftColossal(
    "colossalchests:chest_wall_diamond",
    "dankstorage:dank_6",
    "colossalchests:colossal_chest_diamond"
  );
  craftColossal(
    "colossalchests:chest_wall_obsidian",
    "dankstorage:dank_6",
    "colossalchests:colossal_chest_obsidian"
  );
  craftColossal(
    "colossalchests:chest_wall_iron",
    "dankstorage:dank_3",
    "colossalchests:colossal_chest_iron"
  );

  function craftWallColossal(lingot, bloc, idcraft) {
    e.remove({ id: idcraft });

    e.custom({
      result: {
        item: idcraft,
      },
      pattern: [" A ", "ABA", " A "],
      type: "minecraft:crafting_shaped",
      key: {
        A: { item: lingot },
        B: { item: bloc },
      },
    });
  }

  craftWallColossal(
    "alltheores:copper_ingot",
    "exnihilosequentia:dust",
    "colossal_battery:battery_wall_copper"
  );
  craftWallColossal(
    "minecraft:iron_ingot",
    "colossal_battery:battery_wall_copper",
    "colossal_battery:battery_wall_iron"
  );
  craftWallColossal(
    "alltheores:silver_ingot",
    "colossal_battery:battery_wall_iron",
    "colossal_battery:battery_wall_silver"
  );
  craftWallColossal(
    "minecraft:gold_ingot",
    "colossal_battery:battery_wall_silver",
    "colossal_battery:battery_wall_gold"
  );
  craftWallColossal(
    "minecraft:diamond",
    "colossal_battery:battery_wall_gold",
    "colossal_battery:battery_wall_diamond"
  );
  craftWallColossal(
    "minecraft:obsidian",
    "colossal_battery:battery_wall_diamond",
    "colossal_battery:battery_wall_obsidian"
  );
});
