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.
- Spawn Settings: SpawnSettings.
- Generator Type: varint32.
- Game Type: varint32.
- Is Hardcore: boolean.
- Game Difficulty: varint32.
- Default Spawn Block Position: BlockPos, three varint32.
- Achievements Disabled: boolean.
- Editor World Type: varint32.
- Is Created In Editor, 10. Is Exported From Editor: boolean each.
- Day Cycle Stop Time: varint32.
- Education Edition Offer: varuint32.
- Education Features Enabled: boolean. 14. Education Product ID: string.
- Rain Level, 16. Lightning Level: float LE each.
- Has Confirmed Platform Locked Content, 18. Multiplayer Game Intent, 19. LAN Broadcast Intent: boolean each.
- Xbox Live Broadcast Setting, 21. Platform Broadcast Setting: varint32 each.
- Commands Enabled, 23. Texture Packs Required: boolean each.
- 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.
- Experiments: Experiments.
- Has Bonus Chest Enabled, 27. Start With Map Enabled: boolean each.
- Player Permissions: one byte.
- Server Chunk Tick Range: int32 LE.
- Has Locked Behavior Pack through 39. Emote Chat Muted: ten booleans.
- Base Game Version: string.
- Limited World Width, 42. Limited World Depth: int32 LE each.
- Nether Type: boolean.
- Edu Shared Uri Resource: Button Name string, Link Uri string.
- Override Force Experimental Gameplay: optional boolean, a presence byte and then the value only when present.
- Chat Restriction Level: uint8.
- Disable Player Interactions: boolean.
- Server Editor Connection Policy: varint32.
- 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
difficulty
defaultSpawnPos
dayCycleStopTime
number
rainLevel
number
lightningLevel
number
commandsEnabled
boolean
gameRules
readonly GameRule[]
playerPermissions
config?
LevelSettingsConfig = {}
Returns
LevelSettings
Overrides
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
Returns
void
Throws
Always.
Overrides
serialize()
serialize(
stream):void
Defined in: protocol/src/structure/LevelSettings.ts:233
Serializes the network structure to a binary stream.
Parameters
stream
The binary stream to serialize to.
Returns
void
Overrides
deserialize()
staticdeserialize<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
The binary stream to deserialize from.
Returns
T
An instance of the class T.