export const TAGS = {
  planks: [
    "minecraft:oak_planks",
    "minecraft:spruce_planks",
    "minecraft:birch_planks",
    "minecraft:jungle_planks",
    "minecraft:acacia_planks",
    "minecraft:dark_oak_planks",
    "minecraft:mangrove_planks",
    "minecraft:cherry_planks",
    "minecraft:bamboo_planks",
    "minecraft:crimson_planks",
    "minecraft:warped_planks",
    "minecraft:pale_oak_planks",
  ],
};

export const GAM_RECIPES = [
  {
    inputs: [
      "minecraft:tripwire_hook",
      "tag:planks",
      "tag:planks",
      "minecraft:iron_ingot",
      "minecraft:iron_ingot",
    ],
    result: "pb_gat:gadget_grappling_hook",
  },
  {
    inputs: [
      "pb_gat:trinket_smelt",
      "tag:planks",
      "tag:planks",
      "minecraft:gold_ingot",
      "minecraft:stone",
    ],
    result: "pb_gat:gadget_bridge_builder",
  },
  {
    inputs: [
      "tag:planks",
      "tag:planks",
      "minecraft:torch",
      "minecraft:redstone",
    ],
    result: "pb_gat:gadget_torch_launcher",
  },
  {
    inputs: [
      "pb_gat:trinket_invis",
      "minecraft:obsidian",
      "minecraft:obsidian",
    ],
    result: "pb_gat:gadget_barrier",
  },
  {
    inputs: [
      "minecraft:glass",
      "minecraft:glass",
      "minecraft:glass",
      "minecraft:glass",
      "minecraft:carrot",
      "minecraft:snow",
    ],
    result: "pb_gat:gadget_snowman",
  },
  {
    inputs: [
      "minecraft:iron_ingot",
      "minecraft:iron_ingot",
      "pb_gat:trinket_magnet",
      "pb_gat:trinket_silk_springs",
    ],
    result: "pb_gat:gadget_shockwave",
  },
  {
    inputs: [
      "minecraft:feather",
      "minecraft:feather",
      "pb_gat:trinket_drake_pendant",
    ],
    result: "pb_gat:gadget_recall",
  },
  {
    inputs: [
      "minecraft:leather",
      "minecraft:leather",
      "minecraft:leather",
      "minecraft:stick",
      "minecraft:stick",
    ],
    result: "pb_gat:gadget_glider",
  },
  {
    inputs: [
      "minecraft:iron_ingot",
      "minecraft:iron_ingot",
      "minecraft:gold_ingot",
      "pb_gat:trinket_pocket_singularity",
    ],
    result: "pb_gat:gadget_bucket",
  },
  {
    inputs: [
      "minecraft:iron_ingot",
      "minecraft:iron_ingot",
      "minecraft:bone_meal",
      "pb_gat:trinket_hunger",
    ],
    result: "pb_gat:gadget_watering_can",
  },
  {
    inputs: [
      "minecraft:iron_ingot",
      "minecraft:iron_ingot",
      "minecraft:leather",
      "minecraft:leather",
    ],
    result: "pb_gat:gadget_chest_jack_empty",
  },
  {
    inputs: [
      "pb_gat:trinket_teleport",
      "pb_gat:trinket_ward_constellation",
      "minecraft:stick",
      "minecraft:stick",
      "tag:planks",
      "tag:planks",
    ],
    result: "pb_gat:gadget_mirror",
  },
  {
    inputs: [
      "pb_gat:trinket_gravity_resonator",
      "minecraft:diamond",
      "minecraft:diamond",
      "minecraft:iron_ingot",
      "minecraft:iron_ingot",
    ],
    result: "pb_gat:gadget_gauntlet",
  },
];

export function getAllowedItems() {
  const allowed = new Set();

  for (const recipe of GAM_RECIPES) {
    for (const input of recipe.inputs) {
      if (input.startsWith("tag:")) {
        const tagName = input.slice(4);
        const items = TAGS[tagName] || [];
        items.forEach((i) => allowed.add(i));
      } else {
        allowed.add(input);
      }
    }
  }

  return allowed;
}

export const ALLOWED_ITEMS = getAllowedItems();