Generator settings for GeneratorTypes.FLAT?

This is my code now:

WorldProperties worldProperties = Sponge.getServer().createWorldProperties("flatWorld",
         WorldArchetype.builder()
                 .generator(GeneratorTypes.FLAT)
                 .generatorSettings(GeneratorTypes.FLAT.getGeneratorSettings().set(???))
                 .build());

Sponge.getServer().loadWorld(worldProperties);

If I want to generate a world with 3;30*minecraft\:bedrock;1, what code I have to write in ???

My current SpongeAPI version is 7.0.0-SNAPSHOT

It looks like that generatorSettings are all ignored and there is no way to avoid this right now.
I decided to wait for the implement.

By the way, I looked at SpongeCommon and found that WorldInfo and WorldSettings both have generatorSetting, is this intended?

What you’re looking for is DataQuery.of("customSettings")

I investigated generatorSettings and found that an issue was reported some time ago:

So I went ahead and fixed it

The following code now works:

WorldProperties worldProperties = Sponge.getServer().createWorldProperties("flatWorld",
        WorldArchetype.builder()
                .generator(GeneratorTypes.FLAT)
                .generatorSettings(DataContainer.createNew().set(DataQuery.of("customSettings"), "3;30*minecraft:bedrock;1"))
                .build("myworldarchetype", "My World Archetype"));

   Sponge.getServer().loadWorld(worldProperties);

WorldSettings is an internal minecraft class that is similar in functionality to Sponge’s WorldArchetype, and likewise WorldInfo is similar to WorldProperties
They both have a generator setting, but WorldArchetype is used as a template for creating worlds whereas WorldProperties is a collection of properties per world instance.

1 Like