Skip to content

remove structure config api#2420

Merged
Zidane merged 1 commit intoSpongePowered:api-9from
ImMorpheus:api9/remove-structure-config
Mar 26, 2022
Merged

remove structure config api#2420
Zidane merged 1 commit intoSpongePowered:api-9from
ImMorpheus:api9/remove-structure-config

Conversation

@ImMorpheus
Copy link
Copy Markdown
Contributor

@ImMorpheus ImMorpheus commented Mar 26, 2022

SpongeAPI | Sponge

@Zidane
Copy link
Copy Markdown
Member

Zidane commented Mar 26, 2022

@ImMorpheus

How is this handled now?

@ImMorpheus
Copy link
Copy Markdown
Contributor Author

@Zidane With the current system (api-9) you add structures by creating a StructureGenerationConfig and adding it to the NoiseGenerationConfig.
The NoiseGenerationConfig is then used by the ChunkGenerator

Builder addStructure(Structure structure, SeparatedStructureConfig config);
Builder addStructures(Map<Structure, SeparatedStructureConfig> structures);
Builder removeStructure(Structure structure);

Builder structureConfig(StructureGenerationConfig config);

static <T extends FlatGeneratorConfig> ConfigurableChunkGenerator<T> flat(final T config) {
return Sponge.game().factoryProvider().provide(ChunkGenerator.Factory.class).flat(Objects.requireNonNull(config, "config"));
}
static <T extends NoiseGeneratorConfig> ConfigurableChunkGenerator<T> noise(final BiomeProvider provider, final T config) {
return Sponge.game().factoryProvider().provide(ChunkGenerator.Factory.class).noise(Objects.requireNonNull(provider, "provider"), Objects.requireNonNull(config, "config"));
}
static <T extends NoiseGeneratorConfig> ConfigurableChunkGenerator<T> noise(final BiomeProvider provider, final long seed, final T config) {
return Sponge.game().factoryProvider().provide(ChunkGenerator.Factory.class).noise(Objects.requireNonNull(provider, "provider"), seed, Objects.requireNonNull(config, "config"));
}
static <T extends NoiseGeneratorConfig> ConfigurableChunkGenerator<T> noise(final BiomeProvider provider, final String seed, final T config) {
return Sponge.game().factoryProvider().provide(ChunkGenerator.Factory.class).noise(Objects.requireNonNull(provider, "provider"), seed, Objects.requireNonNull(config, "config"));
}

The ChunkGenerator can be used to generate a world (See WorldTemplate and WorldTest testplugin)

1.18.2 however nuked StructureSettings and decoupled NoiseGenerationConfig from structure generation, added a StructureSet class with a STRUCTURE_SET_REGISTRY and did a complete refactor of structure generation.
This PR removes the current api so that we can update to 1.18.2 and rework our current approach.

@Zidane Zidane merged commit 34c84ec into SpongePowered:api-9 Mar 26, 2022
@ImMorpheus ImMorpheus deleted the api9/remove-structure-config branch March 26, 2022 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants