Jump to content

Recommended Posts

Posted

I am trying to make my own mod and I want to add ores at overworld.

 

A tutorial said I should use biome.addFeature like this:

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class OreGen {
    @SubscribeEvent
    public static void onSetUpEvent(FMLCommonSetupEvent event) {
        for (Biome biome : ForgeRegistries.BIOMES) {
            biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES,
                    Feature.ORE.withConfiguration(
                            new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD,
                                    BlockRegistry.block_mcbbswiki.get().getDefaultState(),
                                    3)
                    ).withPlacement(Placement.DEPTH_AVERAGE.configure(new DepthAverageConfig(20, 5)))
            );
        }
    }
}

However, in minecraft 1.16.4, there's no biome.addFeature method.

 

So, How do I use OreGen?

 

Posted (edited)

First you need to register your feature to the ConfiguredFeature Registry

Then you can add it to the biome generation through the Biome Loading Event (not the Common Setup)

 

if you want an example:

@Mod.EventBusSubscriber(modid = TutorialMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModFeatures {

    public static ConfiguredFeature<?, ?> ORE_SILVER_CONFIG;

    @SubscribeEvent
    public static void setup(FMLCommonSetupEvent event) {
        ORE_SILVER_CONFIG = Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, "ore_silver",
            Feature.ORE.withConfiguration(
                new OreFeatureConfig(
                    OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD,
                    ModBlocks.SILVER_ORE.get().getDefaultState(), 9)
            ).range(64).square().func_242731_b(20)
        );
    }
}

 

@SubscribeEvent
    public void onBiomeLoading(final BiomeLoadingEvent biome) {
        if(biome.getCategory() == Biome.Category.NETHER || biome.getCategory() == Biome.Category.THEEND) return;

        biome.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES)
            .add(() -> ModFeatures.ORE_SILVER_CONFIG);
    }

 

Edited by kiou.23

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.