Search in sources :

Example 1 with BiomeSourceAccessor

use of org.spongepowered.common.accessor.world.level.biome.BiomeSourceAccessor 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;
}
Also used : AttributedBiome(org.spongepowered.api.world.biome.AttributedBiome) Biome(org.spongepowered.api.world.biome.Biome) BiomeSourceAccessor(org.spongepowered.common.accessor.world.level.biome.BiomeSourceAccessor) MultiNoiseBiomeSourceAccessor(org.spongepowered.common.accessor.world.level.biome.MultiNoiseBiomeSourceAccessor) TheEndBiomeSourceAccessor(org.spongepowered.common.accessor.world.level.biome.TheEndBiomeSourceAccessor) OverworldBiomeSource(net.minecraft.world.level.biome.OverworldBiomeSource) ResourceLocation(net.minecraft.resources.ResourceLocation) ConfigurableBiomeProvider(org.spongepowered.api.world.biome.provider.ConfigurableBiomeProvider) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 OverworldBiomeSource (net.minecraft.world.level.biome.OverworldBiomeSource)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 BiomeSourceAccessor (org.spongepowered.common.accessor.world.level.biome.BiomeSourceAccessor)1 MultiNoiseBiomeSourceAccessor (org.spongepowered.common.accessor.world.level.biome.MultiNoiseBiomeSourceAccessor)1 TheEndBiomeSourceAccessor (org.spongepowered.common.accessor.world.level.biome.TheEndBiomeSourceAccessor)1