use of org.spongepowered.api.world.gen.populator.BlockBlob in project SpongeCommon by SpongePowered.
the class MixinBiomeTaiga method buildPopulators.
@Override
public void buildPopulators(World world, SpongeBiomeGenerationSettings gensettings) {
if (this.type == BiomeTaiga.Type.MEGA || this.type == BiomeTaiga.Type.MEGA_SPRUCE) {
BlockBlob blob = BlockBlob.builder().blobCount(VariableAmount.baseWithRandomAddition(0, 3)).block((BlockState) Blocks.MOSSY_COBBLESTONE.getDefaultState()).radius(VariableAmount.baseWithRandomAddition(0, 2)).build();
gensettings.getPopulators().add(blob);
}
DoublePlant fern = DoublePlant.builder().type(DoublePlantTypes.FERN, 1).perChunk(7 * 5).build();
gensettings.getPopulators().add(fern);
super.buildPopulators(world, gensettings);
if (this.type == BiomeTaiga.Type.MEGA || this.type == BiomeTaiga.Type.MEGA_SPRUCE) {
gensettings.getGroundCoverLayers().clear();
gensettings.getGroundCoverLayers().add(new GroundCoverLayer((Double seed) -> {
if (seed > 1.75D) {
return (BlockState) Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
} else if (seed > -0.95D) {
return (BlockState) Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL);
}
return (BlockState) Blocks.GRASS.getDefaultState();
}, WorldGenConstants.GROUND_COVER_DEPTH));
gensettings.getGroundCoverLayers().add(new GroundCoverLayer((BlockState) this.fillerBlock, WorldGenConstants.GROUND_COVER_DEPTH));
}
BiomeDecorator theBiomeDecorator = this.decorator;
for (Iterator<Shrub> it = gensettings.getPopulators(Shrub.class).iterator(); it.hasNext(); ) {
Shrub next = it.next();
if (next.getTypes().size() == 1) {
TableEntry<ShrubType> entry = next.getTypes().getEntries().get(0);
if (entry instanceof WeightedObject && ((WeightedObject<ShrubType>) entry).get() == ShrubTypes.TALL_GRASS) {
it.remove();
}
}
}
Shrub grass = Shrub.builder().perChunk(theBiomeDecorator.grassPerChunk * 128).type(ShrubTypes.FERN, 4).type(ShrubTypes.TALL_GRASS, 1).build();
gensettings.getPopulators().add(grass);
gensettings.getPopulators().removeAll(gensettings.getPopulators(Forest.class));
Forest.Builder forest = Forest.builder();
forest.perChunk(VariableAmount.baseWithOptionalAddition(theBiomeDecorator.treesPerChunk, 1, 0.1));
if (this.type == BiomeTaiga.Type.MEGA || this.type == BiomeTaiga.Type.MEGA_SPRUCE) {
if (this.type == BiomeTaiga.Type.MEGA) {
forest.type(BiomeTreeTypes.POINTY_TAIGA.getLargePopulatorObject().get(), 1);
forest.type(BiomeTreeTypes.TALL_TAIGA.getLargePopulatorObject().get(), 12);
} else {
forest.type(BiomeTreeTypes.TALL_TAIGA.getLargePopulatorObject().get(), 13);
}
forest.type(BiomeTreeTypes.POINTY_TAIGA.getPopulatorObject(), 26 / 3d);
forest.type(BiomeTreeTypes.TALL_TAIGA.getPopulatorObject(), 52 / 3d);
} else {
forest.type(BiomeTreeTypes.POINTY_TAIGA.getPopulatorObject(), 1);
forest.type(BiomeTreeTypes.TALL_TAIGA.getPopulatorObject(), 2);
}
gensettings.getPopulators().add(0, forest.build());
}
use of org.spongepowered.api.world.gen.populator.BlockBlob in project SpongeCommon by SpongePowered.
the class BlockBlobBuilder method build.
@Override
public BlockBlob build() throws IllegalStateException {
if (this.block == null) {
throw new IllegalStateException("Builder is missing required BlockState argument.");
}
BlockBlob populator = (BlockBlob) new WorldGenBlockBlob((Block) this.block.getType(), 2);
populator.setBlock(this.block);
populator.setRadius(this.radius);
populator.setCount(this.count);
return populator;
}
Aggregations