The wonder of open source code is that you can freely copy and modify it, though I will note that most licenses, like my LGPL-3.0 licensed code, do require attribution. The problem of open source code is that you can freely copy and implement other people's mistakes.
The above code is incorrect, and will only generate ore in vanilla biomes, as I finally figured out after bug reports from users. Iterate over the Forge biome register, NOT the vanilla BiomeManager.
For example, if you have an ore that should generate in all overworld-type biomes, code like this works:
public class OreGeneration
{
// Vein/Chunk Count, MinHeight, MaxHeightBase, MaxHeight
private static final CountRangeConfig copper_cfg = new CountRangeConfig(15, 40, 0, 128);
private static final int copper_veinsize = 7;
public static void setupOreGen()
{
for (Biome biome: ForgeRegistries.BIOMES.getValues())
{
// we have no End or Nether ores, so skip those.
if ( biome.getCategory() == Biome.Category.THEEND || biome.getCategory() == Biome.Category.NETHER)
{
continue;
}
// Overworld-type Ore generation
if (SimpleOresConfig.enableCopperOre)
{
biome.addFeature(
GenerationStage.Decoration.UNDERGROUND_ORES,
Biome.createDecoratedFeature(Feature.ORE,
new OreFeatureConfig(
OreFeatureConfig.FillerBlockType.NATURAL_STONE,
ModBlocks.copper_ore.getDefaultState(),
copper_veinsize),
Placement.COUNT_RANGE,
copper_cfg));
} // end if copper_ore
} // end for biomes
} // end setupOreGen()
} // end class
This is, of course, a very stripped-down example. The full mod is here, for those that want to study the code: https://github.com/Sinhika/SimpleOres2