use of org.spongepowered.common.interfaces.world.gen.IPopulatorProvider in project SpongeCommon by SpongePowered.
the class MixinWorldServer method updateWorldGenerator.
@Override
public void updateWorldGenerator() {
// Get the default generator for the world type
DataContainer generatorSettings = this.getProperties().getGeneratorSettings();
SpongeWorldGenerator newGenerator = createWorldGenerator(generatorSettings);
// by the base generation populator
if (newGenerator.getBaseGenerationPopulator() instanceof IChunkGenerator) {
// from a mod chunk provider extending a provider that we mixed into
if (WorldGenConstants.isValid((IChunkGenerator) newGenerator.getBaseGenerationPopulator(), IPopulatorProvider.class)) {
((IPopulatorProvider) newGenerator.getBaseGenerationPopulator()).addPopulators(newGenerator);
}
} else if (newGenerator.getBaseGenerationPopulator() instanceof IPopulatorProvider) {
// If its not a chunk provider but is a populator provider then we call it as well
((IPopulatorProvider) newGenerator.getBaseGenerationPopulator()).addPopulators(newGenerator);
}
for (WorldGeneratorModifier modifier : this.getProperties().getGeneratorModifiers()) {
modifier.modifyWorldGenerator(this.getProperties(), generatorSettings, newGenerator);
}
this.spongegen = createChunkGenerator(newGenerator);
this.spongegen.setGenerationPopulators(newGenerator.getGenerationPopulators());
this.spongegen.setPopulators(newGenerator.getPopulators());
this.spongegen.setBiomeOverrides(newGenerator.getBiomeSettings());
ChunkProviderServer chunkProviderServer = this.getChunkProvider();
chunkProviderServer.chunkGenerator = this.spongegen;
}
Aggregations