fabric how to generate ores code example

Example: fabric how to generate ores

public class ExampleMod implements ModInitializer {
  private static ConfiguredFeature ORE_WOOL_OVERWORLD = Feature.ORE
    .configure(new OreFeatureConfig(
      OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
      Blocks.WHITE_WOOL.getDefaultState(),
      9)) // vein size
    .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(
      0,
      0,
      64)))
    .spreadHorizontally()
    .repeat(20); // number of veins per chunk
 
  @Override
  public void onInitialize() {
    RegistryKey> oreWoolOverworld = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN,
        new Identifier("tutorial", "ore_wool_overworld"));
    Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, oreWoolOverworld.getValue(), ORE_WOOL_OVERWORLD);
    BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, oreWoolOverworld);
  }
}

Tags:

Misc Example