Skip to content

API reference / @jsprismarine/protocol / DimensionDefinition

Class: DimensionDefinition ​

Defined in: protocol/src/structure/DimensionDefinition.ts:29

A DimensionDefinition: the height bounds, generator and sky of one data-driven dimension, as DimensionDataPacket lists them.

The wire layout lives in wire/structures/DimensionDefinition.ts's declarative definition, which this class walks at the protocol version it is handed: the six 2193 fields below, plus Cloud Height and Render Clouds from 2225 on.

Protocol 2193 wire order: 0. Minimum Y: ZigZag varint32, the lowest block y of the dimension.

  1. Height Range: ZigZag varint32, how many blocks sit above Minimum Y.
  2. Generator Type: ZigZag varint32 with the numeric values of Generator.
  3. Dimension Type: ZigZag varint32, the dimension's runtime id.
  4. Pack Id: an mce::UUID, the behavior pack that registered the dimension.
  5. Default Biome: string, the biome identifier the dimension generates with.

Protocol 2225 appends: 6. Cloud Height: ZigZag varint32, the block y clouds render at. 7. Render Clouds: bool, whether the dimension draws clouds. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/dimension-definition/

Extends ​

Constructors ​

Constructor ​

new DimensionDefinition(minimumY?, heightRange?, generatorType?, dimensionType?, packId?, defaultBiome?, cloudHeight?, renderClouds?): DimensionDefinition

Defined in: protocol/src/structure/DimensionDefinition.ts:42

Creates a definition from its fields. Every parameter has a default so deserialize can construct an empty instance before reading the stream.

Parameters ​

minimumY? ​

number = 0

Minimum Y, the lowest block y.

heightRange? ​

number = 0

Height Range, the block count above minimumY; the top y is minimumY + heightRange - 1.

generatorType? ​

Generator = Generator.UNDEFINED

Generator Type.

dimensionType? ​

number = 0

Dimension Type, the runtime id. The vanilla ones are 0 to 2; custom dimensions count from 1000.

packId? ​

UUID = ...

Pack Id of the registering behavior pack.

defaultBiome? ​

string = ''

Default Biome identifier, for example "minecraft:plains".

cloudHeight? ​

number = 0

Cloud Height, the block y clouds render at. On the wire from 2225 on.

renderClouds? ​

boolean = false

Render Clouds, whether the dimension draws clouds. On the wire from 2225 on.

Returns ​

DimensionDefinition

Overrides ​

NetworkStructure.constructor

Properties ​

cloudHeight ​

cloudHeight: number = 0

Defined in: protocol/src/structure/DimensionDefinition.ts:49

Cloud Height, the block y clouds render at. On the wire from 2225 on.


defaultBiome ​

defaultBiome: string = ''

Defined in: protocol/src/structure/DimensionDefinition.ts:48

Default Biome identifier, for example "minecraft:plains".


dimensionType ​

dimensionType: number = 0

Defined in: protocol/src/structure/DimensionDefinition.ts:46

Dimension Type, the runtime id. The vanilla ones are 0 to 2; custom dimensions count from 1000.


generatorType ​

generatorType: Generator = Generator.UNDEFINED

Defined in: protocol/src/structure/DimensionDefinition.ts:45

Generator Type.


heightRange ​

heightRange: number = 0

Defined in: protocol/src/structure/DimensionDefinition.ts:44

Height Range, the block count above minimumY; the top y is minimumY + heightRange - 1.


minimumY ​

minimumY: number = 0

Defined in: protocol/src/structure/DimensionDefinition.ts:43

Minimum Y, the lowest block y.


packId ​

packId: UUID

Defined in: protocol/src/structure/DimensionDefinition.ts:47

Pack Id of the registering behavior pack.


renderClouds ​

renderClouds: boolean = false

Defined in: protocol/src/structure/DimensionDefinition.ts:50

Render Clouds, whether the dimension draws clouds. On the wire from 2225 on.

Methods ​

deserialize() ​

deserialize(stream, protocolVersion?): void

Defined in: protocol/src/structure/DimensionDefinition.ts:69

Reads them back in the same order, filling version-absent fields with their fallbacks.

Parameters ​

stream ​

NetworkBinaryStream

The stream to read from.

protocolVersion? ​

number = protocolVersion2193

The negotiated protocol version; defaults to 2193.

Returns ​

void

Overrides ​

NetworkStructure.deserialize


serialize() ​

serialize(stream, protocolVersion?): void

Defined in: protocol/src/structure/DimensionDefinition.ts:60

Writes the fields the protocol version puts on the wire, in layout order.

Parameters ​

stream ​

NetworkBinaryStream

The stream to write to.

protocolVersion? ​

number = protocolVersion2193

The negotiated protocol version; defaults to 2193.

Returns ​

void

Overrides ​

NetworkStructure.serialize


deserialize() ​

static deserialize<T>(this, stream): T

Defined in: protocol/src/NetworkStructure.ts:28

Deserializes the network structure from a binary stream. The constructor runs with no arguments before the stream is read, so the class must tolerate that.

Type Parameters ​

T ​

T extends NetworkStructure

Parameters ​

this ​

Constructor<T>

stream ​

NetworkBinaryStream

The binary stream to deserialize from.

Returns ​

T

An instance of the class T.

Inherited from ​

NetworkStructure.deserialize


read() ​

static read(stream, protocolVersion?): DimensionDefinition

Defined in: protocol/src/structure/DimensionDefinition.ts:78

Reads a definition in the layout of the given protocol version.

Parameters ​

stream ​

NetworkBinaryStream

The stream to read from.

protocolVersion? ​

number = protocolVersion2193

The negotiated protocol version; defaults to 2193.

Returns ​

DimensionDefinition