Checking whether a seed contains specific biomes is the most common bottleneck in large-scale seed searches. cubiomes offers a layered filtering approach built aroundDocumentation 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.
BiomeFilter and checkForBiomes: rather than generating a full biome map and scanning it, the library works through progressively finer generation layers and aborts as soon as a seed provably cannot satisfy your requirements. For versions up to 1.17, this can eliminate the vast majority of seeds before reaching the expensive final layers.
The BiomeFilter struct
BiomeFilter encodes the biome requirements as a set of bitfields — one bit per biome ID — distributed across the generation layers at which each biome first appears (1:1024 temperature, 1:256 ocean/major, 1:64 edge/rare, 1:16 shore, 1:4 river/mix). The library checks layers from coarsest to finest and aborts the check as soon as any requirement is provably unmet.
setupBiomeFilter so the library correctly assigns each biome to its earliest detection layer and computes derived fields such as specialCnt.
Setting up the filter
| Parameter | Description |
|---|---|
bf | Pointer to a BiomeFilter to initialise |
mc | Minecraft version constant |
flags | Optional flags (see below) |
required | Array of biome IDs that must all be present |
requiredLen | Length of required; pass 0 with NULL for none |
excluded | Array of biome IDs that must not be present |
excludedLen | Length of excluded |
matchany | Array of biome IDs where at least one must be present |
matchanyLen | Length of matchany |
matchany list is satisfied when the search area contains at least one of the listed biomes.
The BF_APPROX flag
PassingBF_APPROX as the flags value enables aggressive early-exit heuristics that trade accuracy for speed:
BF_APPROX set, checkForBiomes may return 0 (fail) for some seeds that would actually pass a full generation check — that is, it can produce false negatives. Use this flag during an initial coarse pass over billions of seeds, then re-verify surviving candidates without the flag.
Checking seeds with checkForBiomes
| Return value | Meaning |
|---|---|
0 | Failed — the seed provably cannot satisfy the filter |
1 | OK — the area was fully generated and all requirements are met |
2 | OK — generation was not completed, but enough layers passed to confirm the requirements |
2 is common when BF_APPROX is active or when requirements are satisfied before the finest layers run. The cache buffer, if non-null, receives the biome array when generation completes (return value 1); its contents are undefined for return value 2.
checkForBiomes internally calls applySeed on the generator, so you do not need to call it yourself before each seed. The generator is left in a partially initialised state after the call; call applySeed before using it for anything else.Monte Carlo biome sampling
For situations where you want statistical confidence that a biome covers a minimum fraction of an area — rather than requiring it to be present at all — usemonteCarloBiomes:
| Parameter | Description |
|---|---|
g | Biome generator with seed already applied |
r | Range to sample |
rng | Random seed controlling the sampling positions |
coverage | Minimum fraction of samples that must evaluate as success, in [0, 1] |
confidence | Statistical confidence level, in (0, 1) — e.g. 0.95 |
eval | Per-position callback returning 1 (success), 0 (fail), -1 (skip), or any other value to abort |
data | Opaque pointer forwarded to eval |
Querying available biomes
Two functions let you discover which biomes can exist for a given version and layer, without testing any particular seed.getAvailableBiomes
mL for IDs 0–63 and mM for IDs 128–191 — indicating every biome that can generate at that layer for the given version. Unlike canBiomeGenerate, this also supports L_OCEAN_TEMP_256 and 1.18+ where the layer ID is ignored.
canBiomeGenerate
biomeID can appear at the given layerId for the target version. Supported layer IDs include:
canBiomeGenerate to validate your BiomeFilter before starting a long search — if a required biome cannot generate in the target version, your filter will never pass.
Recommended filtering pipeline
Build the BiomeFilter once
Call
setupBiomeFilter with your required, excluded, and matchany lists. Reuse the same BiomeFilter across all seeds in a run — it does not hold any per-seed state.Coarse pass with BF_APPROX
Run
checkForBiomes with BF_APPROX set and a coarse Range (e.g. scale=16 or scale=64) over your candidate seed range. Collect seeds that return non-zero.Fine pass without BF_APPROX
Re-run
checkForBiomes on surviving seeds with BF_APPROX cleared and a finer Range (e.g. scale=4). This eliminates the false negatives introduced in step 2.Generate biomes for an area
Use
genBiomes with a Range to generate a full biome map after your seeds pass the filter.Find structure positions
Combine biome filtering with structure searches to find seeds that satisfy both biome and structure requirements.