Strongholds and the world spawn point work differently from every other structure in cubiomes. Rather than picking a single candidate position in a grid region, Minecraft searches until it finds a suitable biome — which means you must iterate through positions in the order the game generates them. cubiomes exposes this as an iterator pattern throughDocumentation 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.
StrongholdIter, initialised by initFirstStronghold and advanced by nextStronghold. The world spawn similarly searches outward from the origin, and you choose between the accurate-but-slow getSpawn or the fast approximation estimateSpawn.
How stronghold generation works
Strongholds are placed in rings radiating outward from the world origin. The first ring contains 3 strongholds; subsequent rings contain more. Each stronghold’s angle within its ring is deterministic given the 48-bit seed, but the exact block position requires a biome check to find the nearest valid biome. Because of this, stronghold iteration has two parts:initFirstStrongholdcomputes the approximate position of the first stronghold (±112 blocks) from the 48-bit seed alone — no biome generator needed.nextStrongholdperforms the biome check for the current iterator position, resolves the accurate block coordinate, and advances the iterator to the next approximate position.
The StrongholdIter struct
nextStronghold, read the accurate position from sh.pos. The nextapprox field holds the rough location of the following stronghold without requiring another biome check.
Initialising the iterator
| Parameter | Description |
|---|---|
sh | Pointer to an uninitialised StrongholdIter; pass NULL to skip initialisation |
mc | Minecraft version constant |
s48 | World seed — only the lower 48 bits are used |
Advancing the iterator
sh->pos, and prepares the next approximate position in sh->nextapprox.
The return value is the number of strongholds that remain after this one. When the return value is 0 or negative, you have exhausted all strongholds for that seed.
For Minecraft 1.19.3 and later you may pass
NULL as the generator to iterate over approximate positions only, skipping biome checks entirely. This is useful for fast range filtering before a full accurate search.Finding the world spawn
cubiomes provides two functions for locating the world spawn:getSpawn performs the full Minecraft spawn search — it locates a valid biome near the origin and then walks the terrain looking for a grass or podzol block. Because cubiomes does not model blocks, it uses a statistical approximation based on biome identity. This function is slow and can take tens of milliseconds for some seeds.
estimateSpawn terminates the search after the first successful biome check, assuming that a grass block is nearby. It is much faster and sufficient for most seed-finding tasks where exact spawn coordinates are not critical. The optional rng output receives the RNG state after the biome check, which can be used to recreate the search.
Complete example: spawn and the first 12 strongholds
Estimate the first stronghold position
initFirstStronghold initialises the iterator and returns the approximate block position of the first stronghold using only the lower 48 bits of the seed. No generator is needed at this stage.Set up and seed the generator
Create a
Generator, call setupGenerator for the target version, then applySeed for the Overworld. Both getSpawn and nextStronghold require a seeded generator.Find the world spawn
Call
getSpawn(&g) to locate the world spawn point. If speed matters more than precision, use estimateSpawn(&g, NULL) instead.Performance considerations
| Function | Speed | Notes |
|---|---|---|
initFirstStronghold | Nanoseconds | No biome check; uses 48-bit seed only |
estimateSpawn | Microseconds | One biome check; approximate result |
nextStronghold (per call) | Microseconds | One biome check per stronghold |
getSpawn | Tens of milliseconds | Full grass-block search |
nextStronghold. If the approximate position is already outside your target radius you can skip the seed without paying for any biome checks.
Find structure positions
Learn the two-stage
getStructurePos / isViableStructurePos workflow for non-stronghold structures.Filter seeds by biome requirements
Combine stronghold iteration with
checkForBiomes to require specific biomes near the stronghold or spawn.