Search in sources :

Example 1 with BiomeGenerationSettingsBuilder

use of net.minecraftforge.common.world.BiomeGenerationSettingsBuilder in project BluePower by Qmunity.

the class WorldGenFlowers method onBiomeLoad.

@SubscribeEvent
public void onBiomeLoad(BiomeLoadingEvent event) {
    int n = getConfigAmount(event.getName());
    if (n > 0) {
        BiomeGenerationSettingsBuilder generation = event.getGeneration();
        ConfiguredFeature<?, ?> feature = WorldGenRegistries.CONFIGURED_FEATURE.get(new ResourceLocation("bluepower:" + Refs.INDIGOFLOWER_NAME + n));
        if (feature != null)
            generation.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, feature);
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) BiomeGenerationSettingsBuilder(net.minecraftforge.common.world.BiomeGenerationSettingsBuilder) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 2 with BiomeGenerationSettingsBuilder

use of net.minecraftforge.common.world.BiomeGenerationSettingsBuilder in project Geolosys by oitsjustjose.

the class PlutonRegistry method onBiomesLoaded.

@SubscribeEvent
public void onBiomesLoaded(BiomeLoadingEvent evt) {
    BiomeGenerationSettingsBuilder settings = evt.getGeneration();
    // Removes vanilla ores
    if (CommonConfig.REMOVE_VANILLA_ORES.get()) {
        for (GenerationStage.Decoration deco : decorations) {
            FeatureUtils.destroyFeature(settings.getFeatures(deco), OreRemover.filterFeatures(settings.getFeatures(deco)));
        }
    }
    DepositFeature o = new DepositFeature(NoFeatureConfig.CODEC);
    settings.withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, o.withConfiguration(NoFeatureConfig.NO_FEATURE_CONFIG));
}
Also used : GenerationStage(net.minecraft.world.gen.GenerationStage) DepositFeature(com.oitsjustjose.geolosys.common.world.feature.DepositFeature) BiomeGenerationSettingsBuilder(net.minecraftforge.common.world.BiomeGenerationSettingsBuilder) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 3 with BiomeGenerationSettingsBuilder

use of net.minecraftforge.common.world.BiomeGenerationSettingsBuilder in project Tropicraft by Tropicraft.

the class TropicraftBiomes method onBiomeLoad.

@SubscribeEvent
public static void onBiomeLoad(BiomeLoadingEvent event) {
    ResourceLocation name = event.getName();
    if (name != null && name.getNamespace().equals(Constants.MODID)) {
        return;
    }
    Biome.BiomeCategory category = event.getCategory();
    Biome.Precipitation precipitation = event.getClimate().precipitation;
    if (precipitation == Biome.Precipitation.SNOW) {
        return;
    }
    BiomeGenerationSettingsBuilder generation = event.getGeneration();
    if (category == Biome.BiomeCategory.BEACH) {
        generation.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, TropicraftFeatures.NORMAL_PALM_TREE.get().configured(NoneFeatureConfiguration.INSTANCE).decorated(Features.Decorators.HEIGHTMAP_SQUARE).decorated(FeatureDecorator.COUNT_EXTRA.configured(new FrequencyWithExtraChanceDecoratorConfiguration(0, 0.08F, 1))));
        generation.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, TropicraftFeatures.CURVED_PALM_TREE.get().configured(NoneFeatureConfiguration.INSTANCE).decorated(Features.Decorators.HEIGHTMAP_SQUARE).decorated(FeatureDecorator.COUNT_EXTRA.configured(new FrequencyWithExtraChanceDecoratorConfiguration(0, 0.08F, 1))));
        generation.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, TropicraftFeatures.LARGE_PALM_TREE.get().configured(NoneFeatureConfiguration.INSTANCE).decorated(Features.Decorators.HEIGHTMAP_SQUARE).decorated(FeatureDecorator.COUNT_EXTRA.configured(new FrequencyWithExtraChanceDecoratorConfiguration(0, 0.08F, 1))));
    } else if (category == Biome.BiomeCategory.JUNGLE) {
        SimpleStateProvider state = new SimpleStateProvider(TropicraftBlocks.PINEAPPLE.get().defaultBlockState());
        generation.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, Feature.RANDOM_PATCH.configured(new RandomPatchConfiguration.GrassConfigurationBuilder(state, new DoublePlantPlacer()).tries(6).canReplace().build()).decorated(Features.Decorators.HEIGHTMAP_DOUBLE_SQUARE));
    }
}
Also used : SimpleStateProvider(net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider) Biome(net.minecraft.world.level.biome.Biome) FrequencyWithExtraChanceDecoratorConfiguration(net.minecraft.world.level.levelgen.placement.FrequencyWithExtraChanceDecoratorConfiguration) ResourceLocation(net.minecraft.resources.ResourceLocation) DoublePlantPlacer(net.minecraft.world.level.levelgen.feature.blockplacers.DoublePlantPlacer) BiomeGenerationSettingsBuilder(net.minecraftforge.common.world.BiomeGenerationSettingsBuilder) RandomPatchConfiguration(net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

BiomeGenerationSettingsBuilder (net.minecraftforge.common.world.BiomeGenerationSettingsBuilder)3 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)3 DepositFeature (com.oitsjustjose.geolosys.common.world.feature.DepositFeature)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 GenerationStage (net.minecraft.world.gen.GenerationStage)1 Biome (net.minecraft.world.level.biome.Biome)1 DoublePlantPlacer (net.minecraft.world.level.levelgen.feature.blockplacers.DoublePlantPlacer)1 RandomPatchConfiguration (net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration)1 SimpleStateProvider (net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider)1 FrequencyWithExtraChanceDecoratorConfiguration (net.minecraft.world.level.levelgen.placement.FrequencyWithExtraChanceDecoratorConfiguration)1