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.

1.15.2: Custom BiomeProvider / BiomeProviderType / BiomeProviderSettings

Featured Replies

Posted

Hey folks,

 

First of all massive gratz and kudos for all the hard work on version 1.15.2, I'm looking at it trying to implement a custom ChunkGenerator and BiomeProvider for a terraingen mod. In order to register a custom BiomeProvider, I assume I'll have to use this during mod initialisation:
 

ForgeRegistries.BIOME_PROVIDER_TYPES.register(myCustBiomeProviderType);

 

In order to do this I'd need to create an instance of BiomeProviderType that uses my custom biomeprovider class. Just like the default static BiomeProviderTypes do in net.minecraft.world.biome.provider.BiomeProviderType, I'd like to call the constructor like so:
 

BiomeProviderType myCustBiomeProviderType = new BiomeProviderType<>(MyCustomBiomeProvider::new, MyCustomBiomeProviderSettings::new);

 

However I can't do that since the constructor of BiomeProviderType is private. In another thread (here) there was a suggestion to use BiomeProviderType's create method, but I don't see how that would add a custom biomeprovider.

 

To make things worse, I have not been able to get accesstransformers to work, perhaps I'm doing something wrong:
 

My xxx_at.cfg:

public net.minecraft.world.biome.provider.BiomeProviderType <init>(Ljava/util/function/Function;Ljava/util/function/Function;)V

 

To top it off, since the constructor uses functional interfaces (which I'm new to), I can't find a way to reflectively create an instance of BiomeProviderType either.

 

Questions:

 

1. How can I create an instance of BiomeProviderType that uses my custom BiomeProvider/BiomeProviderSettings classes, that I can register via ForgeRegistries.BIOME_PROVIDER_TYPES.register()? Am I misunderstanding the way custom BiomeProviders should be registered, or doing something wrong otherwise?

 

Big thanks!

Edited by PeeGee85

  • Author

* I see I should've posted this in the modder support section, not the general support section. Apologies, please move, thanks!

  • Author

Hey @diesieben07, thanks that helps, I'll take a look at the registry events.

 

As for reflectively invoking the constructor, the problem is that it uses functional interfaces as parameters, not objects. newInstance() expects parameters to be supplied as objects, I haven't been able to find a way to add functional interface parameters to a newInstance() call.

 

The constructor:

public BiomeProviderType(Function<C, T> p_i225746_1_, Function<WorldInfo, C> p_i225746_2_)

Normally called like this:

BiomeProviderType myBiomeProviderType = new BiomeProviderType<>(MyBiomeProvider::new, MyBiomeProviderSettings::new);

 

I've been googling functional interfaces, but haven't found a way to add them as parameters when invoking via reflection. Do you have any ideas? Thanks!

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.