use of org.spongepowered.api.world.biome.provider.ConfigurableBiomeProvider in project SpongeCommon by SpongePowered.
the class SpongeBiomeProviderFactory method multiNoise.
@Override
public <T extends MultiNoiseBiomeConfig> ConfigurableBiomeProvider<T> multiNoise(final T config) {
final WritableRegistry<net.minecraft.world.level.biome.Biome> biomeRegistry = BootstrapProperties.registries.registryOrThrow(Registry.BIOME_REGISTRY);
final List<Pair<net.minecraft.world.level.biome.Biome.ClimateParameters, Supplier<net.minecraft.world.level.biome.Biome>>> attributedBiomes = new ArrayList<>();
for (final AttributedBiome attributedBiome : config.attributedBiomes()) {
attributedBiomes.add(Pair.of((net.minecraft.world.level.biome.Biome.ClimateParameters) attributedBiome.attributes(), () -> biomeRegistry.get((ResourceLocation) (Object) attributedBiome.biome().location())));
}
return (ConfigurableBiomeProvider<T>) MultiNoiseBiomeSourceAccessor.invoker$new(config.seed(), attributedBiomes, (MultiNoiseBiomeSource.NoiseParameters) config.temperatureConfig(), (MultiNoiseBiomeSource.NoiseParameters) config.humidityConfig(), (MultiNoiseBiomeSource.NoiseParameters) config.altitudeConfig(), (MultiNoiseBiomeSource.NoiseParameters) config.weirdnessConfig(), Optional.empty());
}
use of org.spongepowered.api.world.biome.provider.ConfigurableBiomeProvider in project SpongeCommon by SpongePowered.
the class SpongeBiomeProviderFactory method layered.
@Override
public <T extends LayeredBiomeConfig> ConfigurableBiomeProvider<T> layered(final T config) {
final WritableRegistry<net.minecraft.world.level.biome.Biome> biomeRegistry = BootstrapProperties.registries.registryOrThrow(Registry.BIOME_REGISTRY);
final OverworldBiomeSource layeredBiomeProvider = new OverworldBiomeSource(config.seed(), config.largeBiomes(), false, biomeRegistry);
final List<net.minecraft.world.level.biome.Biome> biomes = new ArrayList<>();
for (final RegistryReference<Biome> biome : config.biomes()) {
biomes.add(biomeRegistry.get((ResourceLocation) (Object) biome.location()));
}
((BiomeSourceAccessor) layeredBiomeProvider).accessor$possibleBiomes(biomes);
return (ConfigurableBiomeProvider<T>) layeredBiomeProvider;
}
Aggregations