First, you need to make sure you have a line like this in what ever case of the dimension you are generating it in:
generateSurface(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
inside a constructor like this:
public void generate(Random random, int chunkX, int chunkZ, World world,
IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
}
then, you need to generate the ore:
public void generateSurface(Random random, int chunkX, int chunkZ, World world, IChunkProvider ChunkGenerator, IChunkProvider chunkProvider){
for(int i = 0; i < 2; i++){ //rarity
int startX = chunkX * 16 + random.nextInt(16);
int startZ = chunkZ * 16 + random.nextInt(16);
int startY = random.nextInt(32) + 16; //height spawning
BlockPos start = new BlockPos(startX, startY, startZ);
(new WorldGenMinable(your block class.your ore.getDefaultState(), random.nextInt(2) + 10)).generate(world, random, start); //vein size and block to generate
}