crwdns131855:0crwdne131855:0
crwdns131857:0crwdne131857:0
crwdns131859:0crwdne131859:0
crwdns131861:0crwdne131861:0
crwdns131863:0crwdne131863:0
crwdns131865:0crwdne131865:0
crwdns131857:0crwdne131857:0
Note
crwdns131867:0:javadoc:crwdnd131867:0:doc:crwdne131867:0
crwdns131869:0crwdne131869:0
crwdns131871:0crwdne131871: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(WorldCreationSettings world, DataContainer settings, WorldGenerator worldGenerator) {
BiomeGenerationSettings desertSettings = worldGenerator.getBiomeSettings(BiomeTypes.DESERT);
for (Cactus populator : desertSettings.getPopulators(Cactus.class)) {
populator.setHeight(5);
}
}
crwdns131873:0:javadoc:crwdnd131873:0:javadoc:crwdne131873:0
Note
crwdns131875:0:javadoc:crwdnd131875:0:javadoc:crwdne131875:0
crwdns131877:0crwdne131877:0
import org.spongepowered.api.world.gen.populator.Pumpkin;
@Override
public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, WorldGenerator worldGenerator) {
Pumpkin pumpkinPopulator = Pumpkin.builder().perChunk(12).build();
worldGenerator.getPopulators().add(pumpkinPopulator);
}
crwdns131879:0crwdne131879:0
crwdns131881:0crwdne131881:0
Note
crwdns131883:0crwdne131883:0
crwdns131885:0crwdne131885:0
crwdns131859:0crwdne131859:0
crwdns131887:0:javadoc:crwdne131887:0
public class SinusoidalGenerator implements GenerationPopulator {
@Override
public void populate(World world, MutableBlockVolume buffer, ImmutableBiomeArea 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,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);
}
}
crwdns131889:0crwdne131889:0
crwdns131861:0crwdne131861:0
Note
crwdns131891:0crwdne131891:0
crwdns131863:0crwdne131863:0
crwdns131893:0crwdne131893:0
crwdns131895:0crwdne131895:0
Note
crwdns131897:0crwdne131897:0
crwdns131865:0crwdne131865:0
crwdns131899:0:javadoc:crwdne131899:0
crwdns131901:0crwdne131901: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(MutableBiomeArea buffer) {
Vector2i min = buffer.getBiomeMin();
Vector2i max = buffer.getBiomeMax();
for (int x = min.getX(); x <= max.getX(); x++) {
for (int y = min.getY(); y <= max.getY(); y++) {
if (x * x + y * y < HILLS_RADIUS) {
buffer.setBiome(x, y, BiomeTypes.EXTREME_HILLS);
} else if (x * x + y * y < FOREST_RADIUS) {
buffer.setBiome(x, y, BiomeTypes.FOREST);
} else if (x * x + y * y < BEACH_RADIUS) {
buffer.setBiome(x, y, BiomeTypes.BEACH);
} else {
buffer.setBiome(x, y, BiomeTypes.OCEAN);
}
}
}
}
}