crwdns140777:0crwdne140777:0

Warning

crwdns140779:0crwdne140779:0

  • crwdns140781:0crwdne140781:0

  • crwdns140783:0crwdne140783:0

  • crwdns140785:0crwdne140785:0

  • crwdns140787:0crwdne140787:0

  • crwdns140789:0crwdne140789:0

crwdns140781:0crwdne140781:0

Note

crwdns140791:0:javadoc:crwdnd140791:0:doc:crwdne140791:0

crwdns140793:0crwdne140793:0

crwdns140795:0crwdne140795:0

import org.spongepowered.api.world.biome.BiomeGenerationSettings;
import org.spongepowered.api.world.biome.BiomeTypes;
import org.spongepowered.api.world.gen.Populator;
import org.spongepowered.api.world.gen.populator.Cactus;

@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
    BiomeGenerationSettings desertSettings = worldGenerator.getBiomeSettings(BiomeTypes.DESERT);
    for (Cactus populator : desertSettings.getPopulators(Cactus.class)) {
        populator.setHeight(5);
    }
}

crwdns140797:0:javadoc:crwdnd140797:0:javadoc:crwdne140797:0

Note

crwdns140799:0:javadoc:crwdnd140799:0:javadoc:crwdne140799:0

crwdns140801:0crwdne140801:0

import org.spongepowered.api.world.gen.populator.Pumpkin;

@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
    Pumpkin pumpkinPopulator = Pumpkin.builder().perChunk(12).build();
    worldGenerator.getPopulators().add(pumpkinPopulator);
}

crwdns140803:0crwdne140803:0

crwdns140805:0crwdne140805:0

Note

crwdns140807:0crwdne140807:0

crwdns140809:0crwdne140809:0

crwdns140783:0crwdne140783:0

crwdns140811:0:javadoc:crwdne140811:0

public class SinusoidalGenerator implements GenerationPopulator {

    @Override
    public void populate(World world, MutableBlockVolume buffer, ImmutableBiomeVolume biomes) {
        for(int x = buffer.getBlockMin().getX(); x < buffer.getBlockMax().getX(); x++) {
            for(int z = buffer.getBlockMin().getZ(); z < buffer.getBlockMax().getZ(); z++) {
                BiomeType biome = biomes.getBiome(x, 64, z);
                int height = getHeight(x, z, world.getWorldGenerator().getBiomeSettings(biome));
                for(int y = 0; y < height || y < 64; y++) {
                    if(y < height) {
                        buffer.setBlockType(x, y, z, BlockTypes.STONE);
                    } else {
                        buffer.setBlockType(x, y, z, BlockTypes.WATER);
                    }
                }
            }
        }
    }

    private int getHeight(int x, int z, BiomeGenerationSettings biome) {
        double sx = Math.sin(x / 64d) + 1;
        double sz = Math.sin(z / 64d) + 1;
        double value = (sx + sz) / 4d;
        double heightRange = biome.getMaxHeight() - biome.getMinHeight();
        double height = heightRange * value / biome.getMinHeight();
        return GenericMath.floor(height * 256);
    }
}

crwdns140813:0crwdne140813:0

crwdns140785:0crwdne140785:0

Note

crwdns140815:0crwdne140815:0

crwdns140787:0crwdne140787:0

crwdns140817:0crwdne140817:0

crwdns140819:0crwdne140819:0

Note

crwdns140821:0crwdne140821:0

crwdns140789:0crwdne140789:0

crwdns140823:0:javadoc:crwdne140823:0

crwdns140825:0crwdne140825:0

public class IslandBiomeGen implements BiomeGenerator {

    private static final double ISLAND_SIZE = 200f;
    private static final double BEACH_RADIUS = ISLAND_SIZE * ISLAND_SIZE;
    private static final double FOREST_SIZE = ISLAND_SIZE - 7;
    private static final double FOREST_RADIUS = FOREST_SIZE * FOREST_SIZE;
    private static final double HILLS_SIZE = FOREST_SIZE - 120;
    private static final double HILLS_RADIUS = HILLS_SIZE * HILLS_SIZE;

    @Override
    public void generateBiomes(MutableBiomeVolume buffer) {
        Vector3i min = buffer.getBiomeMin();
        Vector3i max = buffer.getBiomeMax();

        for (int x = min.getX(); x <= max.getX(); x++) {
            for (int z = min.getZ(); z <= max.getZ(); z++) {
                if (x * x + z * z < HILLS_RADIUS) {
                    buffer.setBiome(x, 64, z, BiomeTypes.EXTREME_HILLS);
                } else if (x * x + z * z < FOREST_RADIUS) {
                    buffer.setBiome(x, 64, z, BiomeTypes.FOREST);
                } else if (x * x + z * z < BEACH_RADIUS) {
                    buffer.setBiome(x, 64, z, BiomeTypes.BEACH);
                } else {
                    buffer.setBiome(x, 64, z, BiomeTypes.OCEAN);
                }
            }
        }
    }
}