Skip to content

API reference / @jsprismarine/protocol / LevelSettings

Class: LevelSettings ​

Defined in: protocol/src/structure/LevelSettings.ts:138

The settings of a level, as StartGamePacket (field 5) carries them.

Protocol 2193 wire order, with the docs' field names: 0. Seed: uint64 LE.

  1. Spawn Settings: SpawnSettings.
  2. Generator Type: varint32.
  3. Game Type: varint32.
  4. Is Hardcore: boolean.
  5. Game Difficulty: varint32.
  6. Default Spawn Block Position: BlockPos, three varint32.
  7. Achievements Disabled: boolean.
  8. Editor World Type: varint32.
  9. Is Created In Editor, 10. Is Exported From Editor: boolean each.
  10. Day Cycle Stop Time: varint32.
  11. Education Edition Offer: varuint32.
  12. Education Features Enabled: boolean. 14. Education Product ID: string.
  13. Rain Level, 16. Lightning Level: float LE each.
  14. Has Confirmed Platform Locked Content, 18. Multiplayer Game Intent, 19. LAN Broadcast Intent: boolean each.
  15. Xbox Live Broadcast Setting, 21. Platform Broadcast Setting: varint32 each.
  16. Commands Enabled, 23. Texture Packs Required: boolean each.
  17. Rule Data: varuint count, then per rule a Rule Name string, a Rule Can Be Modified boolean, a varuint variant selector (0 none, 1 boolean, 2 int32 LE, 3 float LE) and the value, which is absent for variant 0.
  18. Experiments: Experiments.
  19. Has Bonus Chest Enabled, 27. Start With Map Enabled: boolean each.
  20. Player Permissions: one byte.
  21. Server Chunk Tick Range: int32 LE.
  22. Has Locked Behavior Pack through 39. Emote Chat Muted: ten booleans.
  23. Base Game Version: string.
  24. Limited World Width, 42. Limited World Depth: int32 LE each.
  25. Nether Type: boolean.
  26. Edu Shared Uri Resource: Button Name string, Link Uri string.
  27. Override Force Experimental Gameplay: optional boolean, a presence byte and then the value only when present.
  28. Chat Restriction Level: uint8.
  29. Disable Player Interactions: boolean.
  30. Server Editor Connection Policy: varint32.
  31. Allow Anonymous Block Drops In Editor Worlds: boolean.

Multiplayer Game Intent and LAN Broadcast Intent are always written as true, and Is From World Template and Is World Template Option Locked always as false. Decoding is not implemented here: the client reads StartGame through StartGamePacket, which inlines this layout. https://mojang.github.io/bedrock-protocol-docs/1.26.50/types/level-settings/

Extends ​

Constructors ​

Constructor ​

new LevelSettings(seed, spawnSettings, difficulty, defaultSpawnPos, dayCycleStopTime, rainLevel, lightningLevel, commandsEnabled, gameRules, playerPermissions, config?): LevelSettings

Defined in: protocol/src/structure/LevelSettings.ts:180

Parameters ​

seed ​

bigint

spawnSettings ​

SpawnSettings

difficulty ​

Difficulty

defaultSpawnPos ​

BlockPos

dayCycleStopTime ​

number

rainLevel ​

number

lightningLevel ​

number

commandsEnabled ​

boolean

gameRules ​

readonly GameRule[]

playerPermissions ​

PlayerPermissionLevel

config? ​

LevelSettingsConfig = {}

Returns ​

LevelSettings

Overrides ​

NetworkStructure.constructor

Methods ​

deserialize() ​

deserialize(stream): void

Defined in: protocol/src/structure/LevelSettings.ts:320

Not implemented. The client decodes StartGame, and this structure with it, through StartGamePacket.

Parameters ​

stream ​

NetworkBinaryStream

Returns ​

void

Throws ​

Always.

Overrides ​

NetworkStructure.deserialize


serialize() ​

serialize(stream): void

Defined in: protocol/src/structure/LevelSettings.ts:233

Serializes the network structure to a binary stream.

Parameters ​

stream ​

NetworkBinaryStream

The binary stream to serialize to.

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