crwdns121335:0crwdne121335:0
crwdns121337:0crwdne121337:0
crwdns121339:0crwdne121339:0
crwdns121341:0crwdne121341:0
crwdns121343:0crwdne121343:0
crwdns121345:0crwdne121345:0
crwdns121337:0crwdne121337:0
Note
crwdns121347:0:javadoc:crwdnd121347:0:doc:crwdne121347:0
crwdns121349:0crwdne121349:0
crwdns121351:0crwdne121351: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);
}
}
crwdns121353:0:javadoc:crwdnd121353:0:javadoc:crwdne121353:0
Note
crwdns121355:0:javadoc:crwdnd121355:0:javadoc:crwdne121355:0
crwdns121357:0crwdne121357: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);
}
crwdns121359:0crwdne121359:0
crwdns121361:0crwdne121361:0
Note
crwdns121363:0crwdne121363:0
crwdns121365:0crwdne121365:0
crwdns121339:0crwdne121339:0
crwdns121367:0:javadoc:crwdne121367: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);
}
}
crwdns121369:0crwdne121369:0
crwdns121341:0crwdne121341:0
Note
crwdns121371:0crwdne121371:0
crwdns121343:0crwdne121343:0
crwdns121373:0crwdne121373:0
crwdns121375:0crwdne121375:0
Note
crwdns121377:0crwdne121377:0
crwdns121345:0crwdne121345:0
crwdns121379:0:javadoc:crwdne121379:0
crwdns121381:0crwdne121381: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);
}
}
}
}
}