How to register classes

So I’m used to the forge system where you use an bus in order to register all the classes that you need but with sponge I couldn’t really find anything. What I’m trying to register now is a class that will modify the world’s terrain but I can’t really figure out how to do this with sponge. This is the class I’d like to register:

public class ModifyTerrain implements WorldGeneratorModifier
{
@Override
public String getId() {
return “overflown:beginner”;
}

@Override
public String getName() {
	return "beginner world generation";
}

@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
	BiomeGenerationSettings desertSettings = worldGenerator.getBiomeSettings(BiomeTypes.DESERT);
	for(Cactus populator : desertSettings.getPopulators(Cactus.class))
	{
		populator.setHeight(12);
	}
	Pumpkin pumpkinPopulator = Pumpkin.builder().perChunk(12).build();
	worldGenerator.getPopulators().add(pumpkinPopulator);
}

}

Listen to the GameRegistryEvent.Register<WorldGeneratorModifier> event and call GameRegistryEvent.Register#register(T) on this event with the object you wish to register.

1 Like

ok so I have this:

@Listener
public void gameRegister(GameRegistryEvent.Register<WorldGeneratorModifier event)
{
event.register(new ModifyTerrain());
}

but I was wondering whether or not it would require me to create a new world in order to use this terrain generation, and if so, how would I be able to do this?