Jump to content

Recommended Posts

Posted

Hello!

 

I have to questions regarding World gen:

1. When adding features to a biome in BiomeLoadingEvent, how would you go about checking which biome you're adding that feature to? Right now I test it with:

if(BiomeDictionary.hasType(biomeRegistryKey, BiomeDictionary.Type.NETHER))

but how about checking for if it is a Soul Sand Valley or Crimson Forest?

 

This is my current solution but I don't like it since event.getName() can return null sometimes:

if (biomeName.equals("soul_sand_valley"))

 

2. Where about in generation should I check my config boolean if it is enabled or not?

Is this a good place to do it? This will allow the generation to be changed when a biome is loaded but it will not update if you are in game and change the config:

    @SubscribeEvent(priority = EventPriority.HIGH)
    public static void addFeaturesToBiomes(BiomeLoadingEvent event)
    {
        BiomeGenerationSettingsBuilder generation = event.getGeneration();

        RegistryKey<Biome> biomeRegistryKey = RegistryKey.getOrCreateKey(ForgeRegistries.Keys.BIOMES, Objects.requireNonNull(event.getName(), "Biome registry name was null"));

        //Check here if feature is enabled/disabled in config  
        if (MyConfig.isThisEnabaled && BiomeDictionary.hasType(biomeRegistryKey, BiomeDictionary.Type.OVERWORLD))
        {
            generation.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, getFeature(ModConfiguredFeatures.ROSE_PATCHES));
        }
    }

 

Thanks for the help!

Posted
15 hours ago, Godis_apan said:

1. When adding features to a biome in BiomeLoadingEvent, how would you go about checking which biome you're adding that feature to? Right now I test it with:

I think you can try this:

if(event.getCategory().equals(Biome.Category.NETHER)) {

}

 

 

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.