Jump to content

[SOLVED] [1.16.4] How do I generate ores?


Linky132

Recommended Posts

so as you see in this code i am making it spawn randomly across the map. just to tell u this is for 1.15 the code in 1.16 is something similar to this this code is just to demonstrate how you would write it. also make a separate java class in ModFolder.world.gen.OreGeneration.java and type in code something like this but dont copy, it wont work in 1.16 and replace RegistryHandler.NETHERITE_ORE with the path to the ore you want to generate thats in your registry handler also then in your main.java class where it has your mod id and stuff in the private void setup(final FMLCommonSetupEvent event) u will write OreGeneration.generate(); in the brackets

 

private static void setupOreGeneration() {
    for (Biome biome : ForgeRegistries.BIOMES) {
        biome.addFeature(Decoration.UNDERGROUND_ORES,
                Feature.ORE
                        .withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE,
                                RegistryHandler.NETHERITE_ORE.get().getDefaultState(), 10))
                        .withPlacement(Placement.COUNT_RANGE.configure(new CountRangeConfig(20, 5, 0, 128))));
    }
}


public static void generate() {
    setupOreGeneration();

}
Edited by Somonestolemyusername
Link to comment
Share on other sites

3 hours ago, Somonestolemyusername said:

so as you see in this code i am making it spawn randomly across the map. just to tell u this is for 1.15 the code in 1.16 is something similar to this this code is just to demonstrate how you would write it. also make a separate java class in ModFolder.world.gen.OreGeneration.java and type in code something like this but dont copy, it wont work in 1.16 and replace RegistryHandler.NETHERITE_ORE with the path to the ore you want to generate thats in your registry handler also then in your main.java class where it has your mod id and stuff in the private void setup(final FMLCommonSetupEvent event) u will write OreGeneration.generate(); in the brackets

This is not applicable for 1.16.2+ as the system was changed.

 

First, you will need to register your Configured Feature within the associated WorldGenRegistries. I would suggest looking at how the Features class does the registering and borrow the method. Note that this should be deferred until FMLCommonSetupEvent. For reference, the register event is not thread-safe, so it should be wrapped using the synchronous work queue provided in the event (e.g. enqueueWork). From there, you can attach the feature to the biome(s) of your choice using BiomeLoadingEvent. You can grab the generation settings builder there and add a feature during a specific point in the generation process, in your case most likely UNDERGROUND_ORES.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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