The generator API is the primary interface for producing biome data in cubiomes. You initialize aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Cubitect/cubiomes/llms.txt
Use this file to discover all available pages before exploring further.
Generator once for a given Minecraft version, apply a world seed and dimension, then call genBiomes or getBiomeAt to query biome IDs at any position or scale. The same Generator instance can be reused across seeds by calling applySeed again.
Structs
Generator
Holds all state required to generate biomes for a given MC version, dimension, and seed.
| Field | Type | Description |
|---|---|---|
mc | int | Minecraft version constant from MCVersion. |
dim | int | Active dimension: 0 Overworld, -1 Nether, +1 End. |
flags | uint32_t | Bitmask of generator flags set during setupGenerator. |
seed | uint64_t | The world seed applied via applySeed. |
sha | uint64_t | Internal SHA value derived from the seed. |
nn | NetherNoise | Nether biome noise (populated for MC 1.16+). |
en | EndNoise | End biome noise (populated for MC 1.9+). |
Range
Describes a cuboidal region in scaled coordinates used by genBiomes and allocCache.
| Field | Type | Description |
|---|---|---|
scale | int | Block-to-coordinate ratio. Use 1 for block, 4 for biome. |
x | int | X origin in scaled coordinates. |
z | int | Z origin in scaled coordinates. |
sx | int | Extent along X axis. |
sz | int | Extent along Z axis. |
y | int | Y origin (biome coordinate; ignored pre-1.18 for 2D queries). |
sy | int | Extent along Y axis; 0 is treated as 1. |
Generator flags
Pass these as a bitmask to theflags argument of setupGenerator.
| Constant | Value | Description |
|---|---|---|
LARGE_BIOMES | 0x1 | Enables the Large Biomes world type. |
NO_BETA_OCEAN | 0x2 | Disables Beta ocean generation. |
FORCE_OCEAN_VARIANTS | 0x4 | Forces ocean variants to appear at scales larger than normal. |
Functions
setupGenerator
Generator for the specified Minecraft version. Call this once before using any other generator functions. The generator can then be seeded with applySeed.
Pointer to the
Generator struct to initialize.Minecraft version constant, e.g.
MC_1_21 or MC_1_18. See the MCVersion enum in biomes.h.Bitmask of generator flags:
LARGE_BIOMES, NO_BETA_OCEAN, FORCE_OCEAN_VARIANTS, or 0 for defaults.applySeed
setupGenerator before applySeed. Calling applySeed again with a different seed reuses the same generator without re-initialization.
Pointer to an initialized
Generator.Target dimension. Use
0 for Overworld, -1 for Nether, +1 for End. These correspond to DIM_OVERWORLD, DIM_NETHER, and DIM_END.64-bit world seed.
getBiomeAt
1 for block coordinates or 4 for biome coordinates. Returns -1 (none) on failure.
Pointer to a seeded generator.
Coordinate scale. Must be
1 (block) or 4 (biome column).X coordinate at the specified scale.
Y coordinate (biome coordinate; relevant for 1.18+ 3D biomes).
Z coordinate at the specified scale.
genBiomes
cache with biome IDs for the entire Range cuboid. Access results as cache[y*r.sx*r.sz + z*r.sx + x] where (x,y,z) are relative coordinates within the range. Returns 0 on success.
Pointer to a seeded generator.
Output buffer of length at least
getMinCacheSize(g, r.scale, r.sx, r.sy, r.sz). Use allocCache to allocate it.Scaled range describing the region to generate.
allocCache
free().
Pointer to an initialized generator (seed need not be applied yet).
Range whose dimensions determine the buffer size.
getMinCacheSize
int elements required to generate a volume of (sx, sy, sz) at the given scale. Pass sy = 0 to get the size for a 2D plane (equivalent to sy = 1).
Initialized generator.
Coordinate scale of the planned generation.
Width of the volume.
Height of the volume. Pass
0 to compute the size for a 2D plane.Depth of the volume.
getLayerForScale
0, 1, 4, 16, 64, and 256. A scale of 0 returns the custom entry layer g->entry. Only valid for Overworld generation in MC 1.17 and earlier.
Initialized generator using a layered (pre-1.18) Overworld.
One of
{0, 1, 4, 16, 64, 256}.setupLayerStack
LayerStack for layered biome generation (Overworld, MC 1.0–1.17). Use the higher-level setupGenerator for new code.
Pointer to the
LayerStack to initialize.Minecraft version.
Pass non-zero to enable the Large Biomes world type.
genArea
out[x + z * areaWidth]. Prefer genBiomes for new code.
Layer entry point (e.g. from
getLayerForScale).Output buffer of at least
areaWidth * areaHeight elements.X coordinate of the area origin in layer-scaled coordinates.
Z coordinate of the area origin in layer-scaled coordinates.
Width of the area.
Height (Z extent) of the area.
mapApproxHeight
ids is non-null it is filled with biome IDs for the area. Heights written to y are in blocks.
Output array of
w * h height values in blocks.Optional output array of
w * h biome IDs. Pass NULL to skip biome output.Seeded generator for the Overworld.
Initialized surface noise for the same seed.
X origin in 1:4 scaled coordinates.
Z origin in 1:4 scaled coordinates.
Width of the area.
Depth of the area.