Jump to content

How to force Features to be registered before Biomes


Recommended Posts



I don't understand why this isn't already the case, but I'm trying to add my custom world gen features into vanilla biomes and I am getting the error "Registry Object not present". The features are being registered in the same exact way as my blocks and items. In my Features class:

public static final DeferredRegister<Feature<?>> FEATURES = new DeferredRegister<>(ForgeRegistries.FEATURES, T3L.MODID);
public static final RegistryObject<Feature<TreeFeatureConfig>> WHITE_OAK_TREE	= FEATURES.register("quercus_alba", () -> new TreeFeature(TreeFeatureConfig::deserialize));


In my Main class:

public class T3L
    public static final String MODID = "t3l";

    public T3L()
	IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();


    public void biomeGeneration(RegistryEvent.Register<Biome> event)
	Collection<Biome> biomes = event.getRegistry().getValues();

	for (Biome biome : biomes)
	    List<ConfiguredFeature<?, ?>> configuredFeatures = biome.getFeatures(GenerationStage.Decoration.VEGETAL_DECORATION);

	    for (ConfiguredFeature<?, ?> configuredFeature : configuredFeatures)
		switch (configuredFeature.feature.getRegistryName().getPath())
		    case "normal_tree":
		    case "acacia_tree":
		    case "fancy_tree":
		    case "dark_oak_tree":
		    case "mega_jungle_tree":
		    case "mega_spruce_tree":



	    for (ConfiguredFeature<?, ?> configuredFeature : configuredFeatures)
		biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, configuredFeature);

	    //biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.WHITE_OAK_TREE.get().withConfiguration(Features.WHITE_OAK_CONFIG).withPlacement(Placement.COUNT_EXTRA_HEIGHTMAP.configure(new AtSurfaceWithExtraConfig(10, 0.1F, 1))));



The line I commented out is the problem line. The rest of the code you see in the biome registration event handler is a test, it removes all of the tree generation from every biome, and works as intended.

If I run the program with the line uncommented I'll get an error on WHITE_OAK_TREE that says "Registry Object not present" which could only possibly mean that RegistryEvent.Register<Biome> is firing before RegistryEvent.Register<Feature<?>> and I dont know how to make that not happen

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

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