// Export arrays for use in other files
const multiblocks = [
  "pb_plane:machine_core",
  "pb_plane:module_bender",
  "pb_plane:module_centrifuge",
  "pb_plane:module_condenser",
  "pb_plane:module_schematic",
  "pb_plane:module_sewing_machine",
];
const cores = ["pb_plane:machine_core"];
const modules = [
  "pb_plane:module_bender",
  "pb_plane:module_centrifuge",
  "pb_plane:module_condenser",
  "pb_plane:module_schematic",
  "pb_plane:module_sewing_machine",
];
/* const condenserAccept = [
  // Leaves
  "minecraft:acacia_leaves",
  "minecraft:azalea_leaves",
  "minecraft:azalea_leaves_flowered",
  "minecraft:birch_leaves",
  "minecraft:cherry_leaves",
  "minecraft:dark_oak_leaves",
  "minecraft:jungle_leaves",
  "minecraft:mangrove_leaves",
  "minecraft:oak_leaves",
  "minecraft:spruce_leaves",
  // Saplings
  "minecraft:acacia_sapling",
  "minecraft:azalea",
  "minecraft:flowering_azalea",
  "minecraft:birch_sapling",
  "minecraft:cherry_sapling",
  "minecraft:dark_oak_sapling",
  "minecraft:jungle_sapling",
  "minecraft:mangrove_propagule",
  "minecraft:oak_sapling",
  "minecraft:spruce_sapling",
  // Seeds
  "minecraft:beetroot_seeds",
  "minecraft:melon_seeds",
  "minecraft:pumpkin_seeds",
  "minecraft:torchflower_seeds",
  "minecraft:wheat_seeds",
  "minecraft:pitcher_pod",
  // Crops
  "minecraft:apple",
  "minecraft:beetroot",
  "minecraft:carrot",
  "minecraft:potato",
  "minecraft:poisonous_potato",
  "minecraft:wheat",
  "minecraft:melon_slice",
  "minecraft:melon_block",
  "minecraft:pumpkin",
  "minecraft:carved_pumpkin",
  "minecraft:glow_berries",
  "minecraft:sweet_berries",
  "minecraft:cocoa_beans",
  // Grasses
  "minecraft:short_grass",
  "minecraft:tall_grass",
  "minecraft:seagrass",
  "minecraft:fern",
  "minecraft:large_fern",
  "minecraft:crimson_roots",
  "minecraft:warped_roots",
  "minecraft:nether_sprouts",
  // Mushrooms
  "minecraft:brown_mushroom",
  "minecraft:red_mushroom",
  "minecraft:crimson_fungus",
  "minecraft:warped_fungus",
  // Flowers
  "minecraft:dandelion",
  "minecraft:poppy",
  "minecraft:blue_orchid",
  "minecraft:allium",
  "minecraft:azure_bluet",
  "minecraft:red_tulip",
  "minecraft:orange_tulip",
  "minecraft:white_tulip",
  "minecraft:pink_tulip",
  "minecraft:oxeye_daisy",
  "minecraft:cornflower",
  "minecraft:lily_of_the_valley",
  "minecraft:torchflower",
  "minecraft:wither_rose",
  "minecraft:sunflower",
  "minecraft:lilac",
  "minecraft:rose_bush",
  "minecraft:peony",
  "minecraft:pitcher_plant",
  "minecraft:pink_petals",
  // Vines
  "minecraft:vine",
  "minecraft:twisting_vines",
  "minecraft:weeping_vines",
  // Moss
  "minecraft:moss_block",
  "minecraft:moss_carpet",
  // Other
  "minecraft:waterlily",
  "minecraft:kelp",
  "minecraft:big_dripleaf",
  "minecraft:small_dripleaf_block",
  "minecraft:glow_lichen",
  "minecraft:waterlily",
  "minecraft:sugar_cane",
  "minecraft:nether_wart",
  "minecraft:cactus",
]; */
const condenserAccept = [
  // Group 1: 30% chance
  {
    chance: 30,
    items: [
      { value: "minecraft:beetroot_seeds" },
      { value: "minecraft:dried_kelp" },
      { value: "minecraft:glow_berries" },
      { value: "minecraft:short_grass" },
      { value: "minecraft:grass_block" },
      { value: "minecraft:hanging_roots" },
      { value: "minecraft:mangrove_roots" },
      { value: "minecraft:kelp" },
      { value: "minecraft:acacia_leaves" },
      { value: "minecraft:azalea_leaves" },
      { value: "minecraft:birch_leaves" },
      { value: "minecraft:cherry_leaves" },
      { value: "minecraft:dark_oak_leaves" },
      { value: "minecraft:jungle_leaves" },
      { value: "minecraft:mangrove_leaves" },
      { value: "minecraft:oak_leaves" },
      { value: "minecraft:spruce_leaves" },
      { value: "minecraft:melon_seed" },
      { value: "minecraft:moss_carpet" },
      { value: "minecraft:pink_petals" },
      { value: "minecraft:pitcher_pod" },
      { value: "minecraft:pumpkin_seeds" },
      { value: "minecraft:acacia_sapling" },
      { value: "minecraft:birch_sapling" },
      { value: "minecraft:cherry_sapling" },
      { value: "minecraft:dark_oak_sapling" },
      { value: "minecraft:jungle_sapling" },
      { value: "minecraft:mangrove_propagule" },
      { value: "minecraft:oak_sapling" },
      { value: "minecraft:spruce_sapling" },
      { value: "minecraft:sea_grass" },
      { value: "minecraft:small_dripleaf_block" },
      { value: "minecraft:sweet_berries" },
      { value: "minecraft:torchflower_seeds" },
      { value: "minecraft:wheat_seeds" },
    ],
  },
  // Group 2: 50% chance
  {
    chance: 50,
    items: [
      { value: "minecraft:cactus" },
      { value: "minecraft:dried_kelp_block" },
      { value: "minecraft:azalea_leaves_flowered" },
      { value: "minecraft:glow_lichen" },
      { value: "minecraft:melon_slice" },
      { value: "minecraft:nether_sprouts" },
      { value: "minecraft:sugar_cane" },
      { value: "minecraft:tall_grass" },
      { value: "minecraft:twisting_vines" },
      { value: "minecraft:vines" },
      { value: "minecraft:weeping_vines" },
    ],
  },
  // Group 3: 65% chance
  {
    chance: 65,
    items: [
      { value: "minecraft:apple" },
      { value: "minecraft:azalea" },
      { value: "minecraft:beetroot" },
      { value: "minecraft:big_dripleaf" },
      { value: "minecraft:carrot" },
      { value: "minecraft:cocoa_beans" },
      { value: "minecraft:fern" },
      { value: "minecraft:large_fern" },
      { value: "minecraft:dandelion" },
      { value: "minecraft:poppy" },
      { value: "minecraft:blue_orchid" },
      { value: "minecraft:allium" },
      { value: "minecraft:azure_bluet" },
      { value: "minecraft:red_tulip" },
      { value: "minecraft:orange_tulip" },
      { value: "minecraft:white_tulip" },
      { value: "minecraft:pink_tulip" },
      { value: "minecraft:oxeye_daisy" },
      { value: "minecraft:cornflower" },
      { value: "minecraft:lily_of_the_valley" },
      { value: "minecraft:torchflower" },
      { value: "minecraft:wither_rose" },
      { value: "minecraft:sunflower" },
      { value: "minecraft:lilac" },
      { value: "minecraft:rose_bush" },
      { value: "minecraft:peony" },
      { value: "minecraft:pitcher_plant" },
      { value: "minecraft:crimson_fungus" },
      { value: "minecraft:warped_fungus" },
      { value: "minecraft:waterlily" },
      { value: "minecraft:melon_block" },
      { value: "minecraft:moss_block" },
      { value: "minecraft:brown_mushroom" },
      { value: "minecraft:red_mushroom" },
      { value: "minecraft:mushroom_stem" },
      { value: "minecraft:nether_wart" },
      { value: "minecraft:potato" },
      { value: "minecraft:pumpkin" },
      { value: "minecraft:carved_pumpkin" },
      { value: "minecraft:crimson_roots" },
      { value: "minecraft:warped_roots" },
      { value: "minecraft:nether_sprouts" },
      { value: "minecraft:sea_pickle" },
      { value: "minecraft:shroomlight" },
      { value: "minecraft:spore_blossom" },
      { value: "minecraft:wheat" },
    ],
  },
  // Group 4: 85% chance
  {
    chance: 85,
    items: [
      { value: "minecraft:baked_potato" },
      { value: "minecraft:bread" },
      { value: "minecraft:flowering_azalea" },
      { value: "minecraft:hay_block" },
      { value: "minecraft:brown_mushroom_block" },
      { value: "minecraft:red_mushroom_block" },
      { value: "minecraft:nether_wart_block" },
      { value: "minecraft:pitcher_plant" },
      { value: "minecraft:torchflower" },
      { value: "minecraft:warped_wart_block" },
    ],
  },
  // Group 5: 100% chance
  {
    chance: 100,
    items: [
      { value: "minecraft:cake" },
      { value: "minecraft:pumpkin_pie" },
    ],
  },
];

export { multiblocks, cores, modules, condenserAccept };
// Helper function to find the adjacent block based on direction and side
export function getAdjacentBlock(block, direction, side) {
  const cardinalDirectionTypes = {
    North: "north",
    South: "south",
    East: "east",
    West: "west",
  };

  switch (side) {
    case "left":
      switch (direction) {
        case cardinalDirectionTypes.North:
          return block.west(1);
        case cardinalDirectionTypes.South:
          return block.east(1);
        case cardinalDirectionTypes.East:
          return block.north(1);
        case cardinalDirectionTypes.West:
          return block.south(1);
      }
      break;
    case "far_left":
      switch (direction) {
        case cardinalDirectionTypes.North:
          return block.west(2);
        case cardinalDirectionTypes.South:
          return block.east(2);
        case cardinalDirectionTypes.East:
          return block.north(2);
        case cardinalDirectionTypes.West:
          return block.south(2);
      }
      break;
    case "right":
      switch (direction) {
        case cardinalDirectionTypes.North:
          return block.east(1);
        case cardinalDirectionTypes.South:
          return block.west(1);
        case cardinalDirectionTypes.East:
          return block.south(1);
        case cardinalDirectionTypes.West:
          return block.north(1);
      }
      break;
    case "far_right":
      switch (direction) {
        case cardinalDirectionTypes.North:
          return block.east(2);
        case cardinalDirectionTypes.South:
          return block.west(2);
        case cardinalDirectionTypes.East:
          return block.south(2);
        case cardinalDirectionTypes.West:
          return block.north(2);
      }
      break;
    case "behind":
      switch (direction) {
        case cardinalDirectionTypes.North:
          return block.north(1);
        case cardinalDirectionTypes.South:
          return block.south(1);
        case cardinalDirectionTypes.East:
          return block.east(1);
        case cardinalDirectionTypes.West:
          return block.west(1);
      }
      break;
  }
}
