OpenBase

Structure rules & RNG

Why is there a village right there and nowhere else? Because before the world renders a single block, the engine has already rolled the dice for every structure on the map. This page is that dice log: the region grid that fences every placement, the four random number generators behind the rolls, the gates that keep most candidates empty, and one card per structure with its own numbers, its gate drawn in blocks you can orbit, and the biome list it must satisfy. Everything is read out of the engine's own C code - the same code this site's map runs.

32 structure rules · 3 dimensions20 region types · 9 per-chunk · 1 special22 biome gates · 16,366-hit census4 RNG cores2,387 lines of C, reverse engineered

How the game places a structure

Region types roll one candidate chunk per grid cell; the cell size, the salt and even the number of dice are the structure's own constants. The specimen is the village.

The region grid · one candidate per cell

The world is cut into a grid of region cells, spacing × spacing chunks each. Every cell mixes its coordinates into a region seed with two big constants, the world seed and the structure's own salt:

rs = rx · 341,873,128,712 + rz · 132,897,987,541 + worldSeed + salt

An RNG seeded from that number rolls the candidate's offset inside the cell - and the offset can never leave the band [0, spacing − separation). That band is the whole trick: it keeps any two structures from neighboring cells from crowding each other.

spacing34 chunks (544 blocks)
separation8 chunks
salt10387312
rngMT19937 · low 32 bits of rs
drawfloor((nextInt(26) + nextInt(26)) / 2) per axis

the averaged draw leans candidates toward the cell center; temple-family types roll once per axis instead

The band guarantees no two villages from neighboring cells sit closer than 9 chunks (144 blocks) - and one cell can never grow two.

The four RNG cores

Java Random (LCG)48-bit

seed = (s ^ 0x5DEECE66D) mod 2^48; step: seed = (seed · 0x5DEECE66D + 11) mod 2^48

Trial Chamber, Trail Ruins, Abandoned Camp region draws + every jigsaw chunk RNG

MT19937 (Mersenne Twister)32-bit

mt19937_init((uint32_t) regionSeed)

20 of the 21 region types + the mineshaft, slime, nether fossil chunk features

Named feature seed32-bit

chunkSeed = base ^ (d + (base<<6) + (base>>>2) − 1640531527), base = seedLo32 ^ (cz·h + cx·k)

Amethyst Geode, Fossil, Desert Well

Plain feature seed32-bit

chunkSeed = seedLo32 ^ (cz·o + cx·r)

Desert Temple loot, Ruined Portals, Ravines, Dungeons, End Gateways

The same spots in billions of worlds

4,294,967,296
worlds share one layout (32-bit, MT types)
65,536
worlds (48-bit, Java types)

The placement RNG only ever sees the low bits of the world seed, so adding 2^32 (or 2^48) to a seed moves nothing. The biome gates read the full 64-bit seed: same spots, different climate veto. The finder walks these classes directly: the Sister seeds toggle.

Why the candidate often stays empty

Placement is necessary, not sufficient. After the dice land, the climate gets a veto - and a few types never consult the climate at all.

The coin · fortress or bastion

Both live on the same 30-chunk region cell and the same salt, so the cell's first roll decides - once, permanently:

the cell's first roll: nextInt(6)

< 2 → fortress · one chance in three, and no biome check at all after it.

≥ 2 → the bastion track · two chances in three - but then a 2×2-quart box at the chunk center must be entirely Crimson Forest, Nether Wastes or Soul Sand Valley. A failed box leaves the cell holding neither, forever: the roll is spent.

The biome boxes

Village±2-block cube · all 10 village biomes
Monument±16 deep ocean + ±29 ocean category
Mansion±32 cube · dark forest + the cave band
Templesone block query at the center

The odd ones

ancient city · reads the biome at y = −27, a level check, not a surface one.

shipwreck / ruin · no monument may sit within ±5 chunks of the candidate.

nether portal · rolls no gate at all: every candidate chunk in every cell becomes a portal.

The structure dictionary

One card per structure: the grid constants it rolls on, the RNG core behind the roll, and the gate a candidate must still survive. Pick a type to read its rule.

Region grid
Per-chunk features
Special system
Computed highlights

Village

Overworld · engine type 0 · Region grid

spacing
34 chunks
separation
8 chunks
salt
10387312
draw
average of two rolls
rng
MT19937 (Mersenne Twister) · 32-bit

the gate, in blocks

yaw 324° · pitch 30° · zoom 1.0x±2 x/z · py-2..py+2 · 2x2x2 = 8 climate samples

The village cube: 8 probes around the chunk center, every one inside a village biome. The center sample names the village type. Drag to orbit, scroll or pinch to zoom, arrow keys nudge, Home resets.

the gate

Every climate sample in a ±2-block cube at the chunk's surface center must be one of the 10 village biomes (plains, desert, savanna, snowy and taiga families).

the biome gate

counts measured

the 8 village biomes (all 8 climate samples of the ±2 cube) · 1,176 villages, 48 seeds

Plains(1)424Sunflower Plains(129)26Savanna(35)187Snowy Plains(12)128Taiga(5)166Snowy Taiga(30)115Desert(2)86Meadow(177)44

Every id is the engine's own list entry, and the counts are measured hits at each biome over the census seeds. Legacy ids the modern climate tree can no longer emit are left out: a chip that can never pass a gate says nothing.

the extra rolls

The village type comes from the center biome; a nextDouble < 0.02 roll then flags it zombie (2%).

field notesengine-verified
slime chunks
Slime chunks are the same in every world. The formula MT(cx · 522133279 ^ cz) → nextInt(10) == 0 never touches the world seed, so the slime map Bedrock draws for one seed is the map it draws for all of them (structures.c, BST_SLIME_CHUNK).
fortress / bastion
A fortress and a bastion can never share a region cell. The cell's first nextInt(6) roll picks fortress (< 2) or the bastion track (>= 2), and a failed bastion biome box leaves the cell holding neither, forever (structures.c, BST_BASTION).
strongholds
Bedrock strongholds are not Java's ring system. Three spirals walk outward from the origin hunting for chunks that would grow a village, and the stronghold replaces the village there. Stairway strongholds then roll every 200×200 chunks at 25% with no distance limit - 2,454 records beyond 24,320 blocks verified bit-exact (structures.c, BST_STRONGHOLD).
mansion cave check
The woodland mansion's ±32 cube is a 3D climate check, and its lower half lives in the cave band. The accepted list names the cave biomes outright: Lush Caves (175), Dripstone Caves (174) and, since 1.21.60, Sulfur Caves (187) beside Pale Garden (186). A 20-seed census: 148 of 154 mansions carried cave biomes in the cube, 172,117 of 756,602 samples (22.7%) resolved underground, and seed 42's mansion at (11880, -7528) anchors its center sample in Lush Caves outright. Deep Dark (183), pinned at depth 1.1, never appeared once: the cube's half-unit depth window cannot reach it (structures.c, MANSION_BIOMES).
non-dark-forest mansions
A mansion needs zero dark forest to exist, and when it does the cube is always pure Lush Caves. Where the density scan and the climate spline disagree the anchor drops to py 24 or below and the whole cube passes on Lush alone: 20,000 seeds, 345,227 mansions, 937 under foreign map biomes, 935 buried cubes, not one Dripstone or Sulfur sample among them. That is terrain law: Dripstone's climate region (continentalness +0.30 up) never reaches the coastal band where cubes bury (+0.04 down), and coastal Sulfur needs weirdness below -0.35 while burial terrain holds 0 or above in 98.9 percent of 40,490 measured columns. The only Sulfur ever seen under a foreign map was the map layer itself answering Sulfur Caves at depth 0: a cave biome surfaced over dark forest, cubes anchored at the surface.

The minimum-distance table

Two villages can never sit closer than 144 blocks; two mansions never closer than 336. Both numbers are the placement grid's own floor, read straight out of the region RNG: one candidate per spacing x spacing chunk cell, its offset confined to the first spacing - separation chunks, so candidates in adjacent cells stay (separation + 1) x 16 blocks apart. Every region row below is that same formula on the engine's own constants; the per-chunk family and the spawn spirals have no grid at all, and the table says so.

exact math, no samplingorigin-to-origin blocks20 region grids · 9 per-chunk · 1 special
structurethe rollclosest possible
Region grids
Buried Treasure4 / 2
48 blocks
Shipwreck24 / 4
80 blocks
Nether FortressNether30 / 4
80 blocks
Bastion RemnantNether30 / 4
80 blocks
Ocean Monument32 / 5
96 blocks
Village34 / 8
144 blocks
Desert Temple32 / 8
144 blocks
Jungle Temple32 / 8
144 blocks
Witch Hut32 / 8
144 blocks
Igloo32 / 8
144 blocks
Ocean Ruin20 / 8
144 blocks
Ancient City24 / 8
144 blocks
Trail Ruins34 / 8 + jigsaw
144 blocks
the +-1-chunk jigsaw window can sit below this floor
Abandoned Camp37 / 8 + jigsaw
144 blocks
the +-1-chunk jigsaw window can sit below this floor
Ruined Portal (Nether)Nether25 / 10
176 blocks
End CityEnd20 / 11
192 blocks
Trial Chamber34 / 12 + jigsaw
208 blocks
the +-1-chunk jigsaw window can sit below this floor
Ruined Portal40 / 15 + jigsaw
256 blocks
the +-1-chunk jigsaw window can sit below this floor
Woodland Mansion80 / 20
336 blocks
Pillager Outpost80 / 24
400 blocks
Per-chunk features
Mineshaft0.4% + ramp
no floor
one roll per chunk, so neighbors can both win
Slime Chunk1 in 10, seedless
no floor
one roll per chunk, so neighbors can both win
Amethyst Geode1 in 24
no floor
one roll per chunk, so neighbors can both win
Fossil1 in 64
no floor
one roll per chunk, so neighbors can both win
Desert Well1 in 500
no floor
one roll per chunk, so neighbors can both win
Ravine1 in 100
no floor
one roll per chunk, so neighbors can both win
Dungeon14 tries
no floor
14 tries per chunk: two can even target the same block
End GatewayEnd1 in 700
no floor
highlands chunks only, in-chunk offsets
Nether FossilNethersoul sand gate
no floor
one roll per chunk, so neighbors can both win
Special systems
Stronghold3 spirals
no floor
three spawn spirals plus stairway copies - no grid behind it

A floor is the closest two origins may ever sit, not a promise that any seed puts them there: a failed gate empties that grid cell entirely, so most real pairs sit further apart. The per-chunk family has no floor at all - each chunk rolls its own dice, so neighbors can both win, and two of a chunk's 14 dungeon attempts can even target the same block. The jigsaw types (trial chamber, trail ruins, abandoned camp, overworld ruined portal) place inside the feature chunk's +-1 window, so their true minimum can sit below the grid floor. Enchanted Apple and Zombie Village are filtered views of the Desert Temple and Village scans, so they ride those rows. Click any row to open its rule card above.

How honest is this page

  • 2,387 lines of reverse-engineered Bedrock 26.50 C
  • 831 lines of fastsearch (the same draws, table-free)
  • placements verified against live chunkbase.com: seeds 26 + 31, 20 structure types
  • ruined portals 284/284 wasm oracle; camps 109/109; strongholds 2,639/2,639 bit-exact
  • mansion cube census: 20 seeds, 154 mansions, 756,602 samples
  • non-dark-forest mansions: 6 specimens + a 20,000-seed census, all pure Lush
  • gate biome censuses: 16,366 structure hits sampled at their own gate readout