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

So, I've recently been trying to create a new chunk generator for my mod.

Because I want individual chunk generators per biome, and because the biome class itself can't be extended anymore,

I decided to create a hash map with a resource location as an input and a custom class(with the chunk gen) as an output.

 

The thing is, everytime I want to access this hash map with the resource location of the biome, it returns null.

After a quick debugging sessions it turns out that the method Biome#getRegistryName always returns null, even on vanilla and hardcoded biomes.

 

How can I solve/avoid this problem?

 

Help would be appreciated.

-Budschie

Edited by Budschie

  • Author

So, here is my code:

 

Calling Biome#getRegistryName

Biome biome = worldGenRegion.getBiome(new BlockPos(posXStart + x, 0, posZStart + z));
BiomeGeneratorBase biomeGenerator = BiomeDataHandler.getBiomeData(biome.getRegistryName()).getBiomeGenerator();

 

Setup of the BiomeDataHandler:

BiomeDataHandler.addBiomeData(new ResourceLocation(References.MODID, "green_forest_biome"), new GreenForestBiomeData());
BiomeDataHandler.addBiomeData(new ResourceLocation(References.MODID, "deepnether"), new DeepnetherBiomeData());

 

Here is my GitHub-Repo: https://github.com/Budschie/Deepnether-Mod/tree/1.16.3

  • Author

Is there maybe something else that could identify a biome uniquely, besides from the registry name?

It's not guaranteed to return a proper value. You should pass the biome instance into the biome registry held within DynamicRegistries and do a reverse lookup instead to grab the associated resource location.

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.