Jump to content

[1.15.2] Generating/replacing resources in biomes


Recommended Posts

In my mod I'm generating a variety of resources. Most of these aren't too fancy, and can be handled using vanilla generation methods. Currently using code similar to the below:

//Generate significant clay near the world surface at the shores of plains biomes
Biomes.PLAINS.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.DISK.withConfiguration(
        new SphereReplaceConfig(Blocks.CLAY.getDefaultState(), 7, 5, Lists.newArrayList(new BlockState[]{DIRT, GRASS_BLOCK})))
        .withPlacement(Placement.COUNT_TOP_SOLID.configure(new FrequencyConfig(100)))

//Non-biome specific
for (Biome biome : ForgeRegistries.BIOMES) {
    //Natural Stone is any of stone, andesite, granite, diorite
    //OreFeatureConfig Target, state, size
    //CountRangeConfig is count, bottom offset, top offset, maximum (altitude?)
    //DepthAverageConfig is count, baseline, spread

    biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(
            new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.LIMESTONE.get().getDefaultState(), 120))
            .withPlacement(Placement.COUNT_DEPTH_AVERAGE.configure(new DepthAverageConfig(2, 55, 16))));
    //COUNT_RANGE.configure(new CountRangeConfig(10, 0, 0, 256))));


The code above has the following effects:

In plains biomes only, many parts of the coast next to rivers generate clumps of clay in large quantities. Intended effect.

In all biomes, most of the stone (but not all) around sea level is replaced with limestone using placement generation similar to that of Lapis. However, the vanilla ore has already generated by this point, and the vanilla coal on stone backdrop doesn't blend well on limestone.


My goal is to have portions of vanilla stone replaced with limestone, portions of that replaced with carbonate minerals and dolomite (dolomitic limestone), and portions of the dolomite replaced with zinc/lead sulfides. Vanilla ores will remain embedded in vanilla stone only in lower and higher depths, but not in limestone. How would I go about setting a ore generation order (stone->carving?->limestone->vanilla ores)? Would I need to create my own Feature, FeatureConfig, and/or Placement classes to achieve desired functionality?


In addition, how would I modify existing generated structures, either through removing/replacing? For example, for fossils to generate with pyrite blocks instead of coal blocks.

Edited by Asleep365
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.