Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.