import { event_raincloud as raincloud } from "./dungeoncloudblock";
//import {event_transformOres as transformOres} from "./dungeonminerals";
import {
  event_transformSpiderNest as transformSpiderNest,
} from "./dungeonblocks_tick";
// Importa *todo* como objeto para acceder dinámicamente:
import * as blocks from "./dungeonblocks";

const blockEventMap = [
  ["dungeon:dtick2", transformSpiderNest],
  ["dungeon:fortune_redstone", blocks.event_redstone],

  //  ["dungeon:dtick", transformOres],
  ["dungeon:fortune_glimmeritecrate", blocks.event_glimmerite_crate],
  ["dungeon:fortune_viritumcrate", blocks.event_viritum_crate],
  ["dungeon:fortune_titaniumcrate", blocks.event_titanium_crate],
  ["dungeon:fortune_diamondcrate", blocks.event_diamond_crate],
  ["dungeon:fortune_junglecrate", blocks.event_jungle_crate],
  ["dungeon:fortune_cobaltcrate", blocks.event_cobalt_crate],
  ["dungeon:fortune_woodencrate", blocks.event_wooden_crate],
  ["dungeon:fortune_vitalife", blocks.event_vitalife],
  ["dungeon:fortune_luminarite", blocks.event_luminarite],
  ["dungeon:raincloud", raincloud],
  ["otherworldly_winter:event_mimic5", blocks.event_mimic5],
  ["otherworldly_winter:event_mimic4", blocks.event_mimic4],
  ["otherworldly_winter:event_mimic3", blocks.event_mimic3],
  ["otherworldly_winter:event_mimic2", blocks.event_mimic2],
  ["otherworldly_winter:event_mimic1", blocks.event_mimic1],
  ["dungeon:deepslate", blocks.event_deepslate],
  ["dungeon:stone", blocks.event_stone],
  ["dungeon:fortune_glimmerite", blocks.event_glimmerite],
  ["dungeon:fortune_viritum", blocks.event_viritum],
  ["dungeon:fortune_iron", blocks.event_iron],
  ["dungeon:fortune_coal", blocks.event_coal],
  ["dungeon:fortune_gold", blocks.event_gold],
  ["dungeon:fortune_copper", blocks.event_copper],
  ["dungeon:fortune_diamond", blocks.event_diamond],
  ["dungeon:fortune_lapis", blocks.event_lapis],
  ["dungeon:fortune_emerald", blocks.event_emerald],
  ["dungeon:fortune_jade", blocks.event_jade],
  ["dungeon:fortune_tungsten", blocks.event_tungsten],
  ["dungeon:fortune_titanium", blocks.event_titanium],
  ["dungeon:fortune_silver", blocks.event_silver],
  ["dungeon:fortune_cobalt", blocks.event_cobalt],
];

function registerBlockComponents(registry) {
  for (const [name, component] of blockEventMap) {
    if (component) {
      registry.registerCustomComponent(name, component);
    } else {
      console.warn(`[registerBlockComponents] Componente no encontrado para: ${name}`);
    }
  }
}

export { registerBlockComponents };
