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

# Class: NativeDensityProgram

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

A density program in native memory, made by [NativeWorldgen.createProgram](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeWorldgen.md#createprogram).

## Properties

### stacks

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

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

The stacks the program samples, held so they live as long as it does.

## Accessors

### nativeHandle

#### Get Signature

> **get** **nativeHandle**(): `number`

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

The program's handle, for native code that runs it. It stays valid until [destroy](#destroy),
so keep this program alive while that code names it; 0 after.

##### Returns

`number`

## Methods

### destroy()

> **destroy**(): `void`

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

Frees the program's native memory. Later calls throw. Its stacks stay alive.

#### Returns

`void`

***

### eval()

> **eval**(`x`, `y`, `z`): `number`

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

The program's value at one position.

#### Parameters

##### x

`number`

##### y

`number`

##### z

`number`

#### Returns

`number`

#### Throws

After [destroy](#destroy).
