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

 

 

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:

@Mod(T3L.MODID)
public class T3L
{
    public static final String MODID = "t3l";

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

	Fluids.FLUIDS.register(eventBus);
	Blocks.BLOCKS.register(eventBus);
	Items.VANILLA_ITEMS.register(eventBus);
	Items.T3L_ITEMS.register(eventBus);
	
	Features.FEATURES.register(eventBus);
    }

    @SubscribeEvent
    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":

			configuredFeatures.remove(configuredFeature);
		}
	    }

	    biome.getFeatures(GenerationStage.Decoration.VEGETAL_DECORATION).clear();

	    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

  • Author

Untitled2.png.7a3d607c85e16b022c8de6cf579ae34c.pngUntitled.thumb.png.18733cb04dee6b9e9cadeffc8693f607.png

 

How in the entire hell am I supposed to register Features to Biomes if the biomes are registered first

Guest
This topic is now closed to further replies.

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.