use of org.spongepowered.common.world.type.SpongeWorldType in project SpongeCommon by SpongePowered.
the class MixinWorldServer method createWorldGenerator.
@Override
public SpongeWorldGenerator createWorldGenerator(String settings) {
final WorldServer worldServer = (WorldServer) (Object) this;
final WorldType worldType = worldServer.getWorldType();
final IChunkGenerator chunkGenerator;
final BiomeProvider biomeProvider;
if (worldType instanceof SpongeWorldType) {
chunkGenerator = ((SpongeWorldType) worldType).getChunkGenerator(worldServer, settings);
biomeProvider = ((SpongeWorldType) worldType).getBiomeProvider(worldServer);
} else {
final IChunkGenerator currentGenerator = this.getChunkProvider().chunkGenerator;
if (currentGenerator != null) {
chunkGenerator = currentGenerator;
} else {
final WorldProvider worldProvider = worldServer.provider;
((IMixinWorldProvider) worldProvider).setGeneratorSettings(settings);
chunkGenerator = worldProvider.createChunkGenerator();
}
biomeProvider = worldServer.provider.biomeProvider;
}
return new SpongeWorldGenerator(worldServer, (BiomeGenerator) biomeProvider, SpongeGenerationPopulator.of(worldServer, chunkGenerator));
}
Aggregations