Skip to content

API reference / @jsprismarine/prismarine / world/DimensionType

world/DimensionType ​

Interfaces ​

DimensionType ​

Defined in: packages/prismarine/src/world/DimensionType.ts:34

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

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

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

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

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

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

java ​

readonly java: DimensionTypeDefinition

Defined in: packages/prismarine/src/world/DimensionType.ts:48

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

The lowest block y the client accepts for bedrockId.

name ​

readonly name: string

Defined in: packages/prismarine/src/world/DimensionType.ts:42

The same as 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

The dimension_type attribute that says where the clouds render.


Dimensions ​

const Dimensions: Readonly<Record<"Overworld" | "Nether" | "TheEnd", DimensionType>>

Defined in: packages/prismarine/src/world/DimensionType.ts:127

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

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 | undefined

Defined in: packages/prismarine/src/world/DimensionType.ts:157

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

Parameters ​

bedrockId ​

number

Returns ​

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 | undefined

Defined in: packages/prismarine/src/world/DimensionType.ts:146

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 | 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

Defined in: packages/prismarine/src/world/DimensionType.ts:83

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

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 or higher. Ignored for a type the overlay lists.

Returns ​

DimensionType

Throws ​

When the type has no overlay and customId is absent or below FIRST_CUSTOM_DIMENSION_ID.


isCustomDimensionType() ​

isCustomDimensionType(javaId): boolean

Defined in: packages/prismarine/src/world/DimensionType.ts:67

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