Search in sources :

Example 1 with AttributedBiome

use of org.spongepowered.api.world.biome.AttributedBiome 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());
}
Also used : ArrayList(java.util.ArrayList) AttributedBiome(org.spongepowered.api.world.biome.AttributedBiome) AttributedBiome(org.spongepowered.api.world.biome.AttributedBiome) Biome(org.spongepowered.api.world.biome.Biome) ConfigurableBiomeProvider(org.spongepowered.api.world.biome.provider.ConfigurableBiomeProvider) Pair(com.mojang.datafixers.util.Pair)

Aggregations

Pair (com.mojang.datafixers.util.Pair)1 ArrayList (java.util.ArrayList)1 AttributedBiome (org.spongepowered.api.world.biome.AttributedBiome)1 Biome (org.spongepowered.api.world.biome.Biome)1 ConfigurableBiomeProvider (org.spongepowered.api.world.biome.provider.ConfigurableBiomeProvider)1