Posted February 11, 20205 yr 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 February 11, 20205 yr by PeeGee85
February 11, 20205 yr Author * I see I should've posted this in the modder support section, not the general support section. Apologies, please move, thanks!
February 12, 20205 yr 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.