[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / world/DimensionType

# world/DimensionType

## Interfaces

### DimensionType

Defined in: [packages/prismarine/src/world/DimensionType.ts:34](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L34)

How tall a dimension is, where its floor sits, and what the client and the save call it.

Every vertical bound in the chunk stack derives from one of these rather than from a constant,
because the three vanilla dimensions do not agree on any of them: the Overworld starts at -64
and is 384 blocks tall, the Nether starts at 0 and is 128 as far as the client is concerned,
the End starts at 0 and is 256.

The sub chunk index is the y coordinate shifted right by four, and stays signed: index -4 is
the Overworld's bottom sub chunk, covering y -64 to -49. That is also exactly how the index
byte is stored in a Bedrock world's sub chunk records, so nothing needs rebasing on the way to
disk.

#### Properties

##### bedrockId

> `readonly` **bedrockId**: `number`

Defined in: [packages/prismarine/src/world/DimensionType.ts:38](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L38)

The integer the client, `ChangeDimension` and a LevelDB chunk key use: 0, 1, 2, or 1000 and up.

##### bedrockName

> `readonly` **bedrockName**: `string`

Defined in: [packages/prismarine/src/world/DimensionType.ts:40](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L40)

The client's spelling, `minecraft:nether` for Java's `minecraft:the_nether`.

##### custom

> `readonly` **custom**: `boolean`

Defined in: [packages/prismarine/src/world/DimensionType.ts:50](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L50)

Whether the client has no built-in dimension for this type and has to be told about it.

##### height

> `readonly` **height**: `number`

Defined in: [packages/prismarine/src/world/DimensionType.ts:46](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L46)

How many blocks the client accepts above `minY`; 128 for the Nether where Java says 256.

##### id

> `readonly` **id**: `string`

Defined in: [packages/prismarine/src/world/DimensionType.ts:36](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L36)

The Java `dimension_type` id, `minecraft:the_nether` for the Nether.

##### java

> `readonly` **java**: [`DimensionTypeDefinition`](https://jsprismarine.dev/api/@jsprismarine/worldgen/index.md#dimensiontypedefinition)

Defined in: [packages/prismarine/src/world/DimensionType.ts:48](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L48)

The Java definition, for the fields the overlay leaves alone: sky light, scale, the clock.

##### minY

> `readonly` **minY**: `number`

Defined in: [packages/prismarine/src/world/DimensionType.ts:44](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L44)

The lowest block y the client accepts for [bedrockId](#bedrockid).

##### name

> `readonly` **name**: `string`

Defined in: [packages/prismarine/src/world/DimensionType.ts:42](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L42)

The same as [bedrockName](#bedrockname); the spelling the content runtime keys its worlds by.

## Variables

### CLOUD\_HEIGHT\_ATTRIBUTE

> `const` **CLOUD\_HEIGHT\_ATTRIBUTE**: `"minecraft:visual/cloud_height"` = `'minecraft:visual/cloud_height'`

Defined in: [packages/prismarine/src/world/DimensionType.ts:60](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L60)

The `dimension_type` attribute that says where the clouds render.

***

### Dimensions

> `const` **Dimensions**: `Readonly`\<`Record`\<`"Overworld"` \| `"Nether"` \| `"TheEnd"`, [`DimensionType`](#dimensiontype)\>\>

Defined in: [packages/prismarine/src/world/DimensionType.ts:127](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L127)

The three vanilla dimensions, built from the 26.3 `dimension_type` documents and the overlay.

***

### FIRST\_CUSTOM\_DIMENSION\_ID

> `const` **FIRST\_CUSTOM\_DIMENSION\_ID**: `1000` = `1000`

Defined in: [packages/prismarine/src/world/DimensionType.ts:57](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L57)

The first id a dimension type without a Bedrock overlay gets. A save's `DimensionNumbers` hands
them out from here and keeps each one.

## Functions

### dimensionByBedrockId()

> **dimensionByBedrockId**(`bedrockId`): [`DimensionType`](#dimensiontype) \| `undefined`

Defined in: [packages/prismarine/src/world/DimensionType.ts:157](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L157)

The vanilla dimension a Bedrock integer id names: 0, 1 or 2.

#### Parameters

##### bedrockId

`number`

#### Returns

[`DimensionType`](#dimensiontype) \| `undefined`

The dimension, or undefined for any other id. A custom dimension's id is known to
  its `Level`, not to this table.

***

### dimensionByName()

> **dimensionByName**(`name`): [`DimensionType`](#dimensiontype) \| `undefined`

Defined in: [packages/prismarine/src/world/DimensionType.ts:146](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L146)

The vanilla dimension a name identifies, by either spelling.

`minecraft:nether` and `minecraft:the_nether` both answer the Nether. A bare `nether` is read
as `minecraft:nether`, which is what the old `dimensionByName` accepted.

#### Parameters

##### name

`string`

#### Returns

[`DimensionType`](#dimensiontype) \| `undefined`

The dimension, or undefined for a name no vanilla dimension has. A custom dimension
  is known to its `Level`, not to this table.

***

### dimensionTypeOf()

> **dimensionTypeOf**(`definition`, `javaId`, `customId?`): [`DimensionType`](#dimensiontype)

Defined in: [packages/prismarine/src/world/DimensionType.ts:83](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L83)

Joins a parsed Java `dimension_type` with its Bedrock overlay.

A type the overlay lists keeps the overlay's id and name, and the overlay's bounds where it
has them. A type it does not list is custom: it takes `customId`, keeps its Java name, and has
its Java bounds clamped to the -512 to 512 range the client accepts.

#### Parameters

##### definition

[`DimensionTypeDefinition`](https://jsprismarine.dev/api/@jsprismarine/worldgen/index.md#dimensiontypedefinition)

The parsed Java type.

##### javaId

`string`

The Java `dimension_type` id the definition was loaded under.

##### customId?

`number`

The Bedrock id to give a type without an overlay, [FIRST\_CUSTOM\_DIMENSION\_ID](#first-custom-dimension-id) or
  higher. Ignored for a type the overlay lists.

#### Returns

[`DimensionType`](#dimensiontype)

#### Throws

When the type has no overlay and `customId` is absent or below
  [FIRST\_CUSTOM\_DIMENSION\_ID](#first-custom-dimension-id).

***

### isCustomDimensionType()

> **isCustomDimensionType**(`javaId`): `boolean`

Defined in: [packages/prismarine/src/world/DimensionType.ts:67](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/DimensionType.ts#L67)

Whether a Java `dimension_type` id is custom: one the Bedrock overlay does not list, which takes a number of its own.

#### Parameters

##### javaId

`string`

#### Returns

`boolean`
