Search in sources :

Example 6 with GroundCoverLayer

use of org.spongepowered.api.world.biome.GroundCoverLayer in project SpongeCommon by SpongePowered.

the class MixinBiomeHills method buildPopulators.

@Override
public void buildPopulators(World world, SpongeBiomeGenerationSettings gensettings) {
    super.buildPopulators(world, gensettings);
    gensettings.getGroundCoverLayers().clear();
    gensettings.getGroundCoverLayers().add(new GroundCoverLayer((stoneNoise) -> {
        IBlockState result = Blocks.GRASS.getDefaultState();
        if ((stoneNoise < -1.0D || stoneNoise > 2.0D) && this.type == BiomeHills.Type.MUTATED) {
            result = Blocks.GRAVEL.getDefaultState();
        } else if (stoneNoise > 1.0D && this.type != BiomeHills.Type.EXTRA_TREES) {
            result = Blocks.STONE.getDefaultState();
        }
        return (BlockState) result;
    }, SeededVariableAmount.fixed(1)));
    gensettings.getGroundCoverLayers().add(new GroundCoverLayer((stoneNoise) -> {
        IBlockState result = Blocks.DIRT.getDefaultState();
        if ((stoneNoise < -1.0D || stoneNoise > 2.0D) && this.type == BiomeHills.Type.MUTATED) {
            result = Blocks.GRAVEL.getDefaultState();
        } else if (stoneNoise > 1.0D && this.type != BiomeHills.Type.EXTRA_TREES) {
            result = Blocks.STONE.getDefaultState();
        }
        return (BlockState) result;
    }, WorldGenConstants.GROUND_COVER_DEPTH));
    BiomeDecorator theBiomeDecorator = this.decorator;
    RandomBlock emerald = RandomBlock.builder().block((BlockState) Blocks.EMERALD_ORE.getDefaultState()).placementTarget(WorldGenConstants.STONE_LOCATION).perChunk(VariableAmount.baseWithRandomAddition(3, 6)).height(VariableAmount.baseWithRandomAddition(4, 28)).build();
    gensettings.getPopulators().add(emerald);
    Ore silverfish = Ore.builder().ore((BlockState) Blocks.MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.STONE)).perChunk(7).height(VariableAmount.baseWithRandomAddition(0, 64)).size(9).build();
    gensettings.getPopulators().add(silverfish);
    gensettings.getPopulators().removeAll(gensettings.getPopulators(Forest.class));
    Forest.Builder forest = Forest.builder();
    forest.perChunk(VariableAmount.baseWithOptionalAddition(theBiomeDecorator.treesPerChunk, 1, 0.1));
    forest.type(BiomeTreeTypes.TALL_TAIGA.getPopulatorObject(), 20);
    forest.type(BiomeTreeTypes.OAK.getPopulatorObject(), 9);
    forest.type(BiomeTreeTypes.OAK.getLargePopulatorObject().get(), 1);
    gensettings.getPopulators().add(0, forest.build());
}
Also used : WorldGenConstants(org.spongepowered.common.world.gen.WorldGenConstants) BiomeHills(net.minecraft.world.biome.BiomeHills) Blocks(net.minecraft.init.Blocks) SpongeBiomeGenerationSettings(org.spongepowered.common.world.biome.SpongeBiomeGenerationSettings) BiomeTreeTypes(org.spongepowered.api.world.gen.type.BiomeTreeTypes) World(net.minecraft.world.World) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator) Forest(org.spongepowered.api.world.gen.populator.Forest) GroundCoverLayer(org.spongepowered.api.world.biome.GroundCoverLayer) SeededVariableAmount(org.spongepowered.api.util.weighted.SeededVariableAmount) VariableAmount(org.spongepowered.api.util.weighted.VariableAmount) Final(org.spongepowered.asm.mixin.Final) BlockState(org.spongepowered.api.block.BlockState) IBlockState(net.minecraft.block.state.IBlockState) Ore(org.spongepowered.api.world.gen.populator.Ore) Mixin(org.spongepowered.asm.mixin.Mixin) RandomBlock(org.spongepowered.api.world.gen.populator.RandomBlock) Shadow(org.spongepowered.asm.mixin.Shadow) BlockSilverfish(net.minecraft.block.BlockSilverfish) RandomBlock(org.spongepowered.api.world.gen.populator.RandomBlock) IBlockState(net.minecraft.block.state.IBlockState) Ore(org.spongepowered.api.world.gen.populator.Ore) Forest(org.spongepowered.api.world.gen.populator.Forest) GroundCoverLayer(org.spongepowered.api.world.biome.GroundCoverLayer) BiomeDecorator(net.minecraft.world.biome.BiomeDecorator)

Example 7 with GroundCoverLayer

use of org.spongepowered.api.world.biome.GroundCoverLayer in project SpongeCommon by SpongePowered.

the class SpongeBiomeGenerationSettingsBuilder method groundCover.

@Override
public Builder groundCover(GroundCoverLayer... coverLayers) {
    checkNotNull(coverLayers, "coverLayers");
    this.groundCover.clear();
    for (GroundCoverLayer layer : coverLayers) {
        this.groundCover.add(checkNotNull(layer, "layer"));
    }
    return this;
}
Also used : GroundCoverLayer(org.spongepowered.api.world.biome.GroundCoverLayer)

Example 8 with GroundCoverLayer

use of org.spongepowered.api.world.biome.GroundCoverLayer in project LanternServer by LanternPowered.

the class LanternBiomeGenerationSettingsBuilder method groundCover.

@Override
public Builder groundCover(Iterable<GroundCoverLayer> coverLayers) {
    checkNotNull(coverLayers, "coverLayers");
    this.groundCover.clear();
    for (GroundCoverLayer layer : coverLayers) {
        this.groundCover.add(checkNotNull(layer, "layer"));
    }
    return this;
}
Also used : GroundCoverLayer(org.spongepowered.api.world.biome.GroundCoverLayer)

Aggregations

GroundCoverLayer (org.spongepowered.api.world.biome.GroundCoverLayer)8 IBlockState (net.minecraft.block.state.IBlockState)3 BiomeDecorator (net.minecraft.world.biome.BiomeDecorator)3 BlockState (org.spongepowered.api.block.BlockState)3 Forest (org.spongepowered.api.world.gen.populator.Forest)3 Ore (org.spongepowered.api.world.gen.populator.Ore)2 RandomBlock (org.spongepowered.api.world.gen.populator.RandomBlock)2 Shrub (org.spongepowered.api.world.gen.populator.Shrub)2 BlockSilverfish (net.minecraft.block.BlockSilverfish)1 Blocks (net.minecraft.init.Blocks)1 World (net.minecraft.world.World)1 BiomeHills (net.minecraft.world.biome.BiomeHills)1 ChunkGeneratorSettings (net.minecraft.world.gen.ChunkGeneratorSettings)1 ShrubType (org.spongepowered.api.data.type.ShrubType)1 ChanceTable (org.spongepowered.api.util.weighted.ChanceTable)1 SeededVariableAmount (org.spongepowered.api.util.weighted.SeededVariableAmount)1 VariableAmount (org.spongepowered.api.util.weighted.VariableAmount)1 WeightedObject (org.spongepowered.api.util.weighted.WeightedObject)1 BigMushroom (org.spongepowered.api.world.gen.populator.BigMushroom)1 BlockBlob (org.spongepowered.api.world.gen.populator.BlockBlob)1