Search in sources :

Example 1 with NoiseGeneratorSettings

use of net.minecraft.world.level.levelgen.NoiseGeneratorSettings in project MinecraftForge by MinecraftForge.

the class DimensionSettingsTest method createNoiseGenerationSettings.

/**
 * Create a NoiseGeneratorSettings instance copying all but the structure settings from overworld.
 */
private static NoiseGeneratorSettings createNoiseGenerationSettings() {
    NoiseGeneratorSettings overworld = BuiltinRegistries.NOISE_GENERATOR_SETTINGS.getOrThrow(NoiseGeneratorSettings.OVERWORLD);
    // Make a new StructureSettings with no structures
    StructureSettings structures = new StructureSettings(Optional.empty(), new HashMap<>());
    // Build a new NoiseGeneratorSettings copying all the other options from 'overworld'
    return new NoiseGeneratorSettings(structures, overworld.noiseSettings(), overworld.getDefaultBlock(), overworld.getDefaultFluid(), overworld.surfaceRule(), overworld.seaLevel(), overworld.disableMobGeneration(), overworld.isAquifersEnabled(), overworld.isNoiseCavesEnabled(), overworld.isOreVeinsEnabled(), overworld.isNoodleCavesEnabled(), overworld.useLegacyRandomSource());
}
Also used : StructureSettings(net.minecraft.world.level.levelgen.StructureSettings) NoiseGeneratorSettings(net.minecraft.world.level.levelgen.NoiseGeneratorSettings)

Example 2 with NoiseGeneratorSettings

use of net.minecraft.world.level.levelgen.NoiseGeneratorSettings in project MinecraftForge by MinecraftForge.

the class DimensionSettingsTest method registerSettings.

/**
 * Demonstrates how a mod can register custom DimensionSettings which can be referenced from
 * within a datapack dimension config whilst being discoverable for other mods to add to and
 * remove structures etc from.
 */
private void registerSettings(FMLCommonSetupEvent event) {
    event.enqueueWork(() -> {
        LOGGER.info("Registering custom DimensionSettings for Dimension: {}", TEST_OVERWORLD);
        NoiseGeneratorSettings noiseGenSettings = createNoiseGenerationSettings();
        BuiltinRegistries.register(BuiltinRegistries.NOISE_GENERATOR_SETTINGS, TEST_OVERWORLD, noiseGenSettings);
    });
}
Also used : NoiseGeneratorSettings(net.minecraft.world.level.levelgen.NoiseGeneratorSettings)

Example 3 with NoiseGeneratorSettings

use of net.minecraft.world.level.levelgen.NoiseGeneratorSettings in project Tropicraft by Tropicraft.

the class TropicraftDimension method createGenerator.

public static ChunkGenerator createGenerator(Registry<Biome> biomeRegistry, Registry<NoiseGeneratorSettings> dimensionSettingsRegistry, long seed) {
    Supplier<NoiseGeneratorSettings> dimensionSettings = () -> {
        // fallback to overworld so that we don't crash before our datapack is loaded (horrible workaround)
        NoiseGeneratorSettings settings = dimensionSettingsRegistry.get(DIMENSION_SETTINGS);
        return settings != null ? settings : dimensionSettingsRegistry.getOrThrow(NoiseGeneratorSettings.OVERWORLD);
    };
    TropicraftBiomeProvider biomeSource = new TropicraftBiomeProvider(seed, biomeRegistry);
    return new TropicraftChunkGenerator(biomeSource, seed, dimensionSettings);
}
Also used : TropicraftChunkGenerator(net.tropicraft.core.common.dimension.chunk.TropicraftChunkGenerator) TropicraftBiomeProvider(net.tropicraft.core.common.dimension.biome.TropicraftBiomeProvider) NoiseGeneratorSettings(net.minecraft.world.level.levelgen.NoiseGeneratorSettings)

Aggregations

NoiseGeneratorSettings (net.minecraft.world.level.levelgen.NoiseGeneratorSettings)3 StructureSettings (net.minecraft.world.level.levelgen.StructureSettings)1 TropicraftBiomeProvider (net.tropicraft.core.common.dimension.biome.TropicraftBiomeProvider)1 TropicraftChunkGenerator (net.tropicraft.core.common.dimension.chunk.TropicraftChunkGenerator)1