import { world, system } from "@minecraft/server";

function spawnRayoDeCristalParticles() {
  for (const entity of world.getDimension("minecraft:the_end").getEntities()) {
    if (entity.typeId === "minecraft:ender_crystal") {
      const position = entity.location;
      entity.dimension.spawnParticle("pa:rayo_de_cristal", position);
      entity.dimension.spawnParticle("pa:rayo_de_cristal", position);
    }
  }
}

system.runInterval(spawnRayoDeCristalParticles, 30);