Alright, the first thing you should be aware of is that the min/max height specified in the BiomeType
are
really misnamed, (they’re named according to those fields in MCP but the mcp field names are incorrect). Its
better to look at the vanilla values for various height sets and think about them more like weights:
height_Default = (0.1F, 0.2F)
height_ShallowWaters = (-0.5F, 0.0F)
height_Oceans = (-1.0F, 0.1F)
height_DeepOceans = (-1.8F, 0.1F)
height_LowPlains = (0.125F, 0.05F)
height_MidPlains = (0.2F, 0.2F)
height_LowHills = (0.45F, 0.3F)
height_HighPlateaus = (1.5F, 0.025F)
height_MidHills = (1.0F, 0.5F)
height_Shores = (0.0F, 0.025F)
height_RockyWaters = (0.1F, 0.8F)
height_LowIslands = (0.2F, 0.3F)
height_PartiallySubmerged = (-0.2F, 0.1F)
(See the related issue here https://github.com/SpongePowered/SpongeCommon/issues/107)
Off the top of my head though the first value is something like a base height weight and the second value is
the variance.
I’m a little unsure though on what you are trying to achieve though, perhaps you can give me a little more information.
If you’re trying to use a heightmap to influence biome placements but still use the vanilla terrain generation
including the generation of the actual end height map then you can do something like this:
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);
}
}
}
}
}
This is using a simple series of radii to interpolate a pseudo heightmap of an island centered on (0, 0).
Since I am only specifying the biomes and letting the vanilla heightmap generator do its thing from there
the end result ends up like this:
If you wanted more fine grained control over the final heightmap you would implement GenreatorPopulator and set it on the world generator as the BaseGeneratorPopulator.