Generate a map except BiomeTypes


#1

[Google translate]
Hello,
I would like to generate a map with all biomes except BiomeTypes.OCEAN and BiomeTypes.RIVER. Can we do that?
thank you

Bonjour,
J’aimerais généré une map avec tous les biomes sauf les biomes BiomeTypes.OCEAN et biomes BiomeTypes.RIVER. On peut faire cela ?
Merci


#2

You can… you would need to create a new world generation modifier, and remove the specific biome types you dont want.


#3

Like this?

    BiomeGenerationSettings biome = worldGenerator.getBiomeSettings(BiomeTypes.OCEAN);
    biome.getGenerationPopulators().clear();
    biome.getPopulators().clear();
    biome.getGroundCoverLayers().clear();

#4

Kind of

		for (BiomeType biome : Sponge.getRegistry().getAllOf(BiomeType.class)) {
		    if(!biome.equals(BiomeTypes.DEEP_OCEAN)){
			BiomeGenerationSettings biomeSettings = worldGenerator.getBiomeSettings(biome);
			biomeSettings.getGenerationPopulators().clear();
			biomeSettings.getPopulators().clear();
			biomeSettings.getGroundCoverLayers().clear();
		    }
			

		}

This is a snippet of code from one of my world generator plugins that creates an all ocean world.

This should be enough for you to figure out what you want.


#5

My code:
WorldArchetype :

  	WorldArchetype worldSettings = WorldArchetype.builder()
  			.enabled(true)
  			.loadsOnStartup(false)
  			.keepsSpawnLoaded(false)
  			.dimension(DimensionTypes.OVERWORLD)
  			.generator(GeneratorTypes.OVERWORLD)
  			.generatorModifiers(new WorldGenModifier())
  			.build(worldName_copie, worldName_copie);

WorldGeneratorModifier :

public class WorldGenModifier implements WorldGeneratorModifier {
@Override
public String getId() {
// TODO Auto-generated method stub
return “admintool:mappersonnalise”;
}

@Override
public String getName() {
    return "Map Personnalisé";
}

@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {

    LinkedList<BiomeType> biomeList = new LinkedList<BiomeType>();
    biomeList.add(BiomeTypes.OCEAN);
    biomeList.add(BiomeTypes.DEEP_OCEAN);
    biomeList.add(BiomeTypes.FROZEN_OCEAN);
    biomeList.add(BiomeTypes.RIVER);
    biomeList.add(BiomeTypes.FROZEN_RIVER);

  for (BiomeType biome : Sponge.getRegistry().getAllOf(BiomeType.class)) {
        if(biomeList.contains(biome)){
            BiomeGenerationSettings biomeSettings = worldGenerator.getBiomeSettings(biome);
            biomeSettings.getGenerationPopulators().clear();
            biomeSettings.getPopulators().clear();
            biomeSettings.getGroundCoverLayers().clear();
        }
  }
}

}

@Listener
public void onWorldGeneratorModifierRegistration(GameRegistryEvent.Register<WorldGeneratorModifier> event) {
logger.info(“GameRegistryEvent.Register<WorldGeneratorModifier>”);
event.register(new WorldGenModifier());
}


[Google translate]
Yet it still gives me a BiomeTypes.DEEP_OCEAN biome while I removed it !!!

[FR]
Pourtant cela me donne quand même un biome BiomeTypes.DEEP_OCEAN alors que je l’ai enlevé!!!