[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/native-worldgen](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/index.md) / NativeWorldgen

# NativeWorldgen

## Classes

- [NativeAquifer](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeAquifer.md)
- [NativeCellProgram](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeCellProgram.md)
- [NativeClimateSearch](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeClimateSearch.md)
- [NativeDensityProgram](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md)
- [NativeNoiseStack](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeNoiseStack.md)
- [NativeSurface](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeSurface.md)
- [NativeWorldgen](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeWorldgen.md)

## Interfaces

### NativeAquiferSource

Defined in: [NativeWorldgen.ts:204](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L204)

What [NativeWorldgen.createAquifer](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeWorldgen.md#createaquifer) needs: `@jsprismarine/worldgen`'s noise aquifer for one chunk extent.

#### Properties

##### defaultFluid

> `readonly` **defaultFluid**: `number`

Defined in: [NativeWorldgen.ts:220](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L220)

One of [NativeFluid](#nativefluid)'s codes but `none`.

##### extent

> `readonly` **extent**: readonly \[`number`, `number`, `number`, `number`, `number`, `number`\]

Defined in: [NativeWorldgen.ts:217](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L217)

The lowest block x, y and z of the extent, then the highest, inclusive.

##### programs

> `readonly` **programs**: readonly \[[`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md), [`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md), [`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md), [`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md), [`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md), [`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md)\]

Defined in: [NativeWorldgen.ts:206](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L206)

The barrier, floodedness, spread, lava, exclusion and surface level programs, in that order.

##### seaLevel

> `readonly` **seaLevel**: `number`

Defined in: [NativeWorldgen.ts:218](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L218)

##### seedLanes

> `readonly` **seedLanes**: readonly \[`number`, `number`, `number`, `number`\]

Defined in: [NativeWorldgen.ts:215](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L215)

The aquifer's Xoroshiro positional seed as four unsigned 32-bit lanes, low half first.

##### skipSamplingAboveY

> `readonly` **skipSamplingAboveY**: `number`

Defined in: [NativeWorldgen.ts:222](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L222)

The highest y the aquifer samples cells for.

***

### NativeCellSource

Defined in: [NativeWorldgen.ts:233](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L233)

A cell program, as `@jsprismarine/worldgen`'s `CellProgram` lays a density tree out: records of
[CELL\_WORDS](#cell-words) words, root first, the constants they name, how many `interpolated` cells
they read, and the cell's size.

#### Properties

##### cellCount

> `readonly` **cellCount**: `number`

Defined in: [NativeWorldgen.ts:236](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L236)

##### constants

> `readonly` **constants**: `Float64Array`

Defined in: [NativeWorldgen.ts:235](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L235)

##### nodes

> `readonly` **nodes**: `Int32Array`

Defined in: [NativeWorldgen.ts:234](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L234)

##### xz

> `readonly` **xz**: `number`

Defined in: [NativeWorldgen.ts:237](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L237)

##### y

> `readonly` **y**: `number`

Defined in: [NativeWorldgen.ts:238](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L238)

***

### NativeClimateSource

Defined in: [NativeWorldgen.ts:246](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L246)

A climate search tree, as `@jsprismarine/worldgen`'s climate index flattens it: per node, seven
min/max pairs in `bounds`, its child range, its leaf value index (-1 for a subtree) and its first
leaf rank, then the child list.

#### Properties

##### bounds

> `readonly` **bounds**: `Float64Array`

Defined in: [NativeWorldgen.ts:247](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L247)

##### childCounts

> `readonly` **childCounts**: `Uint32Array`

Defined in: [NativeWorldgen.ts:249](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L249)

##### children

> `readonly` **children**: `Uint32Array`

Defined in: [NativeWorldgen.ts:252](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L252)

##### childStarts

> `readonly` **childStarts**: `Uint32Array`

Defined in: [NativeWorldgen.ts:248](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L248)

##### firstLeafRanks

> `readonly` **firstLeafRanks**: `Uint32Array`

Defined in: [NativeWorldgen.ts:251](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L251)

##### maxDepth

> `readonly` **maxDepth**: `number`

Defined in: [NativeWorldgen.ts:254](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L254)

The most nodes from the root through one leaf.

##### valueIndices

> `readonly` **valueIndices**: `Int32Array`

Defined in: [NativeWorldgen.ts:250](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L250)

***

### NativeNoiseLayer

Defined in: [NativeWorldgen.ts:278](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L278)

One octave of a noise stack, as `@jsprismarine/worldgen`'s `NoiseStack` holds it: a Perlin
noise's permutation table and offsets, the factor its coordinates are scaled by, and its weight.

#### Properties

##### amplitude

> `readonly` **amplitude**: `number`

Defined in: [NativeWorldgen.ts:286](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L286)

The octave's weight, a single-precision value.

##### frequency

> `readonly` **frequency**: `number`

Defined in: [NativeWorldgen.ts:284](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L284)

##### offsetX

> `readonly` **offsetX**: `number`

Defined in: [NativeWorldgen.ts:281](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L281)

##### offsetY

> `readonly` **offsetY**: `number`

Defined in: [NativeWorldgen.ts:282](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L282)

##### offsetZ

> `readonly` **offsetZ**: `number`

Defined in: [NativeWorldgen.ts:283](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L283)

##### permutation

> `readonly` **permutation**: `ArrayLike`\<`number`\>

Defined in: [NativeWorldgen.ts:280](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L280)

The 256-entry permutation table.

##### smearY?

> `readonly` `optional` **smearY?**: `number`

Defined in: [NativeWorldgen.ts:291](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L291)

`SmearedPerlinNoise`'s `fudgeYScale`: the step the lattice's y fraction snaps down to, as
old blended noise samples. Absent or 0 for plain Perlin noise.

***

### NativeProgramSource

Defined in: [NativeWorldgen.ts:265](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L265)

A density program, as `@jsprismarine/worldgen` encodes a density function tree: records of
[PROGRAM\_WORDS](#program-words) words, root first, with the constants, link lists and noise stacks they
name, and the number of memo slots its caches use.

#### Properties

##### cacheSlots

> `readonly` **cacheSlots**: `number`

Defined in: [NativeWorldgen.ts:271](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L271)

##### constants

> `readonly` **constants**: `Float64Array`

Defined in: [NativeWorldgen.ts:267](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L267)

##### links

> `readonly` **links**: `Int32Array`

Defined in: [NativeWorldgen.ts:268](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L268)

##### nodes

> `readonly` **nodes**: `Int32Array`

Defined in: [NativeWorldgen.ts:266](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L266)

##### stacks

> `readonly` **stacks**: readonly [`NativeNoiseStack`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeNoiseStack.md)[]

Defined in: [NativeWorldgen.ts:270](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L270)

The stacks its noise records sample; they have to outlive the program.

***

### NativeSurfaceSource

Defined in: [NativeWorldgen.ts:173](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L173)

What [NativeWorldgen.createSurface](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeWorldgen.md#createsurface) needs: a material rule program laid out for the C.

#### Properties

##### biomeSets

> `readonly` **biomeSets**: `Uint32Array`

Defined in: [NativeWorldgen.ts:179](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L179)

The biome conditions' membership bitsets, [biomeWords](#biomewords) words each.

##### biomeWords

> `readonly` **biomeWords**: `number`

Defined in: [NativeWorldgen.ts:180](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L180)

##### conditions

> `readonly` **conditions**: `Float64Array`

Defined in: [NativeWorldgen.ts:177](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L177)

[NativeSurfaceLayout.conditionDoubles](#conditiondoubles) doubles per condition.

##### ops

> `readonly` **ops**: `Int32Array`

Defined in: [NativeWorldgen.ts:175](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L175)

The program's ops, three words each.

##### programs

> `readonly` **programs**: readonly [`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md)[]

Defined in: [NativeWorldgen.ts:184](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L184)

The density, richness and gap programs the vein records name, kept alive with the program.

##### stateCount

> `readonly` **stateCount**: `number`

Defined in: [NativeWorldgen.ts:185](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L185)

##### veins

> `readonly` **veins**: `Float64Array`

Defined in: [NativeWorldgen.ts:182](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L182)

[NativeSurfaceLayout.veinDoubles](#veindoubles) doubles per ore vein.

##### zoomSeed

> `readonly` **zoomSeed**: readonly \[`number`, `number`\]

Defined in: [NativeWorldgen.ts:187](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L187)

The biome jitter seed's unsigned high and low 32 bits.

## Variables

### ABI\_VERSION

> `const` **ABI\_VERSION**: `1` = `1`

Defined in: [NativeWorldgen.ts:9](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L9)

The interface version this binding speaks; it must equal the library's `JWG_ABI_VERSION`.

***

### CELL\_WORDS

> `const` **CELL\_WORDS**: `6` = `6`

Defined in: [NativeWorldgen.ts:226](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L226)

The 32-bit words of one cell program record, `JWG_CELL_WORDS` in the C.

***

### NativeFluid

> `const` **NativeFluid**: `object`

Defined in: [NativeWorldgen.ts:191](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L191)

The fluid codes [NativeAquifer.fill](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeAquifer.md#fill) writes, `JWG_FLUID_*` in the C.

#### Type Declaration

##### air

> `readonly` **air**: `0` = `0`

##### lava

> `readonly` **lava**: `2` = `2`

##### none

> `readonly` **none**: `4` = `4`

No fluid: the position keeps the dimension's default block.

##### other

> `readonly` **other**: `3` = `3`

The dimension's default fluid when it is neither water, lava nor air.

##### schedule

> `readonly` **schedule**: `128` = `0x80`

Set on a code whose position wants a fluid tick.

##### water

> `readonly` **water**: `1` = `1`

***

### NativeSurfaceCondition

> `const` **NativeSurfaceCondition**: `object`

Defined in: [NativeWorldgen.ts:156](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L156)

The condition record types of the surface program.

#### Type Declaration

##### abovePreliminarySurface

> `readonly` **abovePreliminarySurface**: `8` = `8`

##### biome

> `readonly` **biome**: `0` = `0`

##### hole

> `readonly` **hole**: `7` = `7`

##### noise

> `readonly` **noise**: `1` = `1`

##### steep

> `readonly` **steep**: `6` = `6`

##### stoneDepth

> `readonly` **stoneDepth**: `9` = `9`

##### unanswered

> `readonly` **unanswered**: `10` = `10`

A condition the C does not answer, such as temperature; the block falls back.

##### verticalGradient

> `readonly` **verticalGradient**: `2` = `2`

##### verticalGradientLegacy

> `readonly` **verticalGradientLegacy**: `11` = `11`

A vertical gradient drawing from Java's legacy random source.

##### water

> `readonly` **water**: `4` = `4`

##### yAbove

> `readonly` **yAbove**: `3` = `3`

***

### NativeSurfaceLayout

> `const` **NativeSurfaceLayout**: `object`

Defined in: [NativeWorldgen.ts:136](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L136)

The layout of the surface program's records and results, `JWG_SURFACE_*` in the C.

#### Type Declaration

##### barren

> `readonly` **barren**: `1` = `1`

A vein cell whose density cannot be positive anywhere.

##### columnFields

> `readonly` **columnFields**: `6` = `6`

##### conditionDoubles

> `readonly` **conditionDoubles**: `8` = `8`

##### conditionPerColumn

> `readonly` **conditionPerColumn**: `7` = `7`

The condition record's word that is nonzero for a condition that reads the column alone.

##### fallback

> `readonly` **fallback**: `-2` = `-2`

A block that reached a condition the C does not answer, which the TypeScript runs.

##### fallbackFields

> `readonly` **fallbackFields**: `4` = `4`

The doubles of one fallback entry: block index, stone depth above and below, water height.

##### frameFields

> `readonly` **frameFields**: `18` = `18`

##### noWater

> `readonly` **noWater**: `-2147483648` = `-2147483648`

The water height a fallback entry gives where no fluid sits above.

##### unchanged

> `readonly` **unchanged**: `-1` = `-1`

A block the rule leaves alone.

##### veinDoubles

> `readonly` **veinDoubles**: `12` = `12`

***

### PROGRAM\_WORDS

> `const` **PROGRAM\_WORDS**: `6` = `6`

Defined in: [NativeWorldgen.ts:258](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L258)

The 32-bit words of one density program record, `JWG_PROGRAM_WORDS` in the C.
