Minecraft Wiki
Advertisement
Brush
This article needs cleanup to comply with the style guide. [discuss]
Please help improve this page. The talk page may contain suggestions.
Reason: need to check whether there's anything out of date
Information icon
This feature is exclusive to Bedrock Edition. 
This article is about the format since Bedrock Edition 1.2.13. For the format in former game versions, see Bedrock Edition level format/History.

Bedrock Edition uses a modified version of Google's LevelDB, which uses the Zlib compression format for level storage.

LevelDB based format[]

Mojang variant LevelDB format[]

Mojang has modified Google's Original LevelDB to add Zlib compression and Windows support. The code is available at https://github.com/Mojang/leveldb-mcpe, and the building instructions are documented by Tommaso at https://twitter.com/_tomcc/status/477950809427427328.

For a Java implementation of LevelDB + Zlib, see https://github.com/tinfoiled/leveldb

Google's leveldb library has evolved extensively since Mojang released their version, but the Mojang version still works (as of 2022). The code does require some minor tweaks to compile:

  • db/snappy_compressor.cc should refer include <snappy.h> instead of <snappy/snappy.h>
  • table/table_test.cc contains two references to snappy that are unresolvable but irrelevant. port::Snappy_Compress and leveldb::SnappyCompressor. If these are simply commented out the rest will compile and function properly.

The database is stored in the db/ subdirectory of a Bedrock Edition world. The database path which is passed to the LevelDB API is this directory path, not the path to any file within it. It seems this is also where terrain generation is stored. This is because you can turn an old world infinite by replacing its db folder with one from an infinite world.

Chunk key format[]

A database key for data regarding a chunk is the concatenation of:

  • Two signed 32-bit little-endian integers (x and z in chunk coordinates, respectively),
  • An optional third 32-bit little-endian integer (1 for the Nether, 2 for the End, omitted for the Overworld),
  • A one-byte tag specifying the type of record represented by the key (see table), and
  • (for a "SubChunkPrefix" record) a one-byte subchunk index (from 0 to 15).

Accordingly, such a key may be 9, 10, 13 or 14 bytes long. Not all subchunks necessarily exist for a given chunk.

The "BlockEntity", "Entity" and "PendingTicks" records are represented by a sequence of concatenated root tags in a variant of NBT which stores the lengths and the multi-byte integer types in little-endian format, as opposed to the big-endian format used by Java Edition or the original NBT specification.

The value 0 is used in the "Version" record in old style worlds; higher values are used in infinite worlds.

Key type tags
Tag byte Name Structure Description
Dec Hex ASCII
43 2B + Data3D Heightmap (256x2 bytes)

Biome data (varying lengths)

Biomes are stored as palettes similar to blocks. Exactly 25 palettes are written. Biome IDs are written as integers.
44 2C , Version 1 byte A byte
45 2D - Data2D Heightmap (256x2 bytes)

2D biomes (256x1 bytes)

Biome IDs are written as 8-bit integers. No longer written since v1.18.0.
46 2E . Data2DLegacy Heightmap (256x2 bytes)

2D biomes (256x4 bytes)

Each entry of the biome array contains a biome ID in the first byte, and the final 3 bytes are red/green/blue respectively. No longer written since v1.0.0.
47 2F / SubChunkPrefix Subchunk version (1 byte) Version-dependent data Terrain for a 16×16×16 subchunk
48 30 0 LegacyTerrain Block IDs (32768 bytes)

Block meta (32768 nibbles)

Block sky light (32768 nibbles)

Block light (32768 nibbles)

Heightmap (256x1 bytes)

2D biomes (256x4 bytes)

Data ordered in XZY order, unlike Java.

No longer written since v1.0.0.

Biomes are IDs plus RGB colours similar to Data2DLegacy.

49 31 1 BlockEntity List of NBT compound roots Block entity data (little-endian NBT)
50 32 2 Entity List of NBT compound roots Entity data (little-endian NBT)
51 33 3 PendingTicks List of NBT compound roots Pending tick data (little-endian NBT)
52 34 4 LegacyBlockExtraData Entry count (4 bytes)

Entries: Key (4 bytes), Value (2 bytes).

Array of blocks that appear in the same place as other blocks. Used for grass appearing inside snow layers prior to v1.2.13. No longer written as of v1.2.13.
53 35 5 BiomeState
54 36 6 FinalizedState 4 bytes A 32-bit little endian integer
55 37 7 ConversionData No longer used
56 38 8 BorderBlocks Education Edition Feature
57 39 9 HardcodedSpawners Bounding boxes for structure spawns stored in binary format
58 3A : RandomTicks List of NBT compound roots Random tick data (little-endian NBT)
59 3B ; Checksums xxHash checksums of other chunk records. No longer written as of v1.18.0.
61 3D = MetaDataHash
61 3E > GeneratedPreCavesAndCliffsBlending Not used
63 3F ? BlendingBiomeHeight Not used
64 40 @ BlendingData
65 41 A ActorDigestVersion
118 76 v LegacyVersion 1 byte Moved to 44 in v1.16.100

Other keys[]

There's also the special key ~local_player for an entity data entry that holds the local player entity. If entity data exists here, it takes precedence over the player data stored in level.dat. The value associated with the ~local_player key is NBT encoded and only has a single compound tag at the root level.

There's also a special key for remote players which consists of two parts. The first part is the prefix "player_" (without the quotes) and the second part is the client ID which is contained in the remote player's clientid.txt file. For example, player_-12345678 would be the key for a remote client with an client ID of -12345678. The value associated with the "player_" prefixed key is NBT encoded and only has a single compound tag at the root level.

There's also a special "game_flatworldlayers" key of length 20 for flat worlds. The value associated with this key is a set of numbers in ASCII text format. An example of a value associated with the "game_flatworldlayers" key is "[7,3,3,2]" where the value length for this example is 9.

There are several keys related to villages

  • VILLAGE_[0-9a-f\\-]+_DWELLERS
    • Consists mainly of an entity/mob ID's. Dwellers include villagers, iron golems, and cats.
  • VILLAGE_[0-9a-f\\-]+_INFO
    • Includes the village bounding box.
  • VILLAGE_[0-9a-f\\-]+_POI
    • Provides a mapping between villagers and work stations. Bed assignments do not appear to be stored.
  • VILLAGE_[0-9a-f\\-]+_PLAYERS

Other keys start with the following strings

  • actorprefix
  • digp
  • map_
  • portals
  • schedulerWT
  • structuretemplate
  • tickingarea

Sample parsers of Bedrock level-db[]

  • An example implementation of a Bedrock level-db parser can be found in minecraft_mmccoo. This implementation walks the NBTs of all block, entities/mobs, elevations, and village related items.

NBT structures[]

The following articles document NBT structures of block entity and entity.

level.dat[]

The level.dat is still in uncompressed NBT format. The file begins with an 8-byte header, consisting of a little-endian 4-byte integer indicating the type of the file, which is 3 (was 2 before latest update) for level.dat. It is followed by another integer containing the length of the file, minus the header.

NBT Structure[]

  • : World data.
    •  abilities: The default permissions for players in the world.
      •  attackmobs: 1 or 0 (true/false) - true if the player can attack mobs.
      •  attackplayers: 1 or 0 (true/false) - true if the player can attack other players.
      •  build: 1 or 0 (true/false) - true if the player can place blocks.
      •  doorsandswitches: 1 or 0 (true/false) - true if the player is able to interact with redstone components.
      •  flying: 1 or 0 (true/false) - true if the player is currently flying.
      •  flySpeed: The flying speed, always 0.05.
      •  instabuild: 1 or 0 (true/false) - true if the player can instantly destroy blocks.
      •  invulnerable: 1 or 0 (true/false) - true if the player is immune to all damage and harmful effects.
      •  lightning: 1 or 0 (true/false) - true if the player was struck by lightning.
      •  mayfly: 1 or 0 (true/false) - true if the player can fly.
      •  mine: 1 or 0 (true/false) - true if the player can destroy blocks.
      •  mute: 1 or 0 (true/false) - true if the player messages cannot be seen by other players.
      •  noclip: 1 or 0 (true/false) - true if the player can phase through blocks.
      •  op: 1 or 0 (true/false) - true if the player has operator commands.
      •  opencontainers: 1 or 0 (true/false) - true if the player is able to open containers.
      •  permissionsLevel: What permissions a player will default to, when joining a world.
      •  playerPermissionsLevel: What permissions a player has.
      •  teleport: 1 or 0 (true/false) - true if the player is allowed to teleport.
      •  walkSpeed: The walking speed, always 0.1.
      •  worldbuilder: 1 or 0 (true/false) - true if the player is a world builder.
    •  allowdestructiveobjects: The allowdestructiveobjects game rule.
    •  allowmobs: The allowmobs game rule.
    •  baseGameVersion: The version of Minecraft that is the maximum version to load resources from. Eg. setting this to 1.16.0 removes any features that were added after version 1.16.0. [more information needed]
    •  BiomeOverride: Makes the world into a single biome world and the biome set here is the biome of this single biome world. [more information needed]
    •  bonusChestEnabled: 1 or 0 (true/false) - true if the bonus chest is enabled.
    •  bonusChestSpawned: 1 or 0 (true/false) - true if the bonus chest has been placed in the world. Turning this to false will spawn another bonus chest near the spawn coordinates.
    •  codebuilder: [more information needed]
    •  commandblockoutput: The commandblockoutput game rule.
    •  CenterMapsToOrigin: 1 or 0 (true/false) - true if the maps should be on a grid or centered to exactly where they are created. Default to 0.
    •  commandblocksenabled: The commandblocksenabled game rule.
    •  commandsEnabled: 1 or 0 (true/false) - true if cheats are on.
    •  ConfirmedPlatformLockedContent: 1 or 0 (true/false) - tells if the world has Platform-Specific texture packs or content. Used to prevent cross play in specific worlds, that use assets only allowed on specific consoles.
    •  currentTick: [more information needed]
    •  Difficulty: The current difficulty setting. 0 is Peaceful, 1 is Easy, 2 is Normal, and 3 is Hard.
    •  Dimension: The dimension the player is in. 0 is the Overworld.
    •  dodaylightcycle: The dodaylightcycle game rule.
    •  doentitiydrops: The doentitiydrops game rule.
    •  dofiretick: The dofiretick game rule.
    •  doimmediaterespawn: The doimmediaterespawn game rule.
    •  doinsomnia: The doinsomnia game rule.
    •  dolimitedcrafting: The dolimitedcrafting game rule.
    •  domobloot: The domobloot game rule.
    •  domobspawning: The domobspawning game rule.
    •  dotiledrops: The dotiledrops game rule.
    •  doweathercycle: The doweathercycle game rule.
    •  drowningdamage: The drowningdamage game rule.
    •  educationFeaturesEnabled: [more information needed]
    •  EducationOid: An UUID. [more information needed]
    •  EducationProductId: [more information needed]
    •  eduOffer: Marks a world as an Education Edition world (worlds with this set to 1 will not open on Bedrock!).
    •  eduSharedResource
    •  experiments
      •  experiments_ever_used: 1 or 0 (true/false) - true if the world is locked on experimental gameplay.
      •  saved_with_toggled_experiments: 1 or 0 (true/false) - true if the world has been saved with experiments on before.
      • ... Additional bytes for each experiment that Minecraft has/had.
    •  falldamage: The falldamage game rule.
    •  firedamage: The firedamage game rule.
    •  FlatWorldLayers: JSON that controls generation of flat worlds. Default is {"biome_id":1,"block_layers":[{"block_name":"minecraft:bedrock","count":1},{"block_name":"minecraft:dirt","count":2},{"block_name":"minecraft:grass","count":1}],"encoding_version":6,"structure_options":null,"world_version":"version.post_1_18"}.
    •  freezedamage: The freezedamage game rule.
    •  functioncommandlimit: The functioncommandlimit game rule.
    •  globalmute: The globalmute game rule.
    •  ForceGameType: 1 or 0 (true/false) - true if force the player into the game mode defined in GameType.
    •  GameType: The default game mode of the player. 0 is Survival, 1 is Creative, 2 is Adventure, and 3 is Spectator.
    •  Generator: The world type. 0 is Old, 1 is Infinite , and 2 is Flat.
    •  hasBeenLoadedInCreative: [more information needed]
    •  hasLockedBehaviorPack: [more information needed]
    •  hasLockedResourcePack: [more information needed]
    •  immutableWorld: Is read-only.
    •  InventoryVersion: [more information needed]
    •  isCreatedInEditor: 1 or 0 (true/false) - true if it was created from the bedrock editor.
    •  isExportedFromEditor: 1 or 0 (true/false) - true if exported from the bedrock editor.
    •  isFromLockedTemplate: 1 or 0 (true/false) - true if the world is created from a world template where the world options were intended not to be modified.
    •  isFromWorldTemplate: 1 or 0 (true/false) - true if the world is created from a world template.
    •  isRandomSeedAllowed
    •  IsSingleUseWorld: 1 or 0 (true/false) - (unused) may cause world to not save, or delete after use. Seems to default back to false when a world is loaded.
    •  isWorldTemplateOptionLocked: 1 or 0 (true/false) - true if the world options cannot be modified until the user accepts that they are changing the map.
    •  keepinventory: The keepinventory game rule.
    •  LANBroadcast: [more information needed]
    •  LANBroadcastIntent: [more information needed]
    •  lastOpenedWithVersion: Five  ints representing the last version with which the world was opened. Eg. for the beta/preview 1.20.30.22 the version is 1 20 30 22 1.
    •  LastPlayed: Stores the Unix time stamp (in seconds) when the player saved the game.
    •  LevelName: Specifies the name of the world.
    •  lightningLevel: [more information needed]
    •  lightningTime: [more information needed]
    •  LimitedWorldOriginX: The X coordinate where limited (old) world generation started.
    •  LimitedWorldOriginY: The Y coordinate where limited (old) world generation started.
    •  LimitedWorldOriginZ: The Z coordinate where limited (old) world generation started.
    •  LimitedWorldWidth: The width (in chunks) of the borders surrounding the (old) world generation. Defaults to 16.
    •  LimitedWorldDepth: The depth (in chunks) of the borders surrounding the (old) world generation. Defaults to 16.
    •  maxcommandchainlength: The maxcommandchainlength game rule.
    •  MinimumCompatibleClientVersion: Five  ints representing the minimum compatible client version that is needed to open the world. Eg. for the beta/preview 1.20.30.22 the minimum compatible version is 1 20 30 0 0.
    •  mobgriefing: [more information needed]
    •  MultiplayerGame: [more information needed]
    •  MultiplayerGameIntent: [more information needed]
    •  naturalregeneration: The naturalregeneration game rule.
    •  NetherScale: Defaults to 8. This is used to tell the game how many Overworld blocks go into one nether block (X blocks in the nether = 1 block in the overworld).
    •  NetworkVersion: [more information needed]
    •  Platform: Seems to store the platform that the level is created on. Currently observed value is 2.
    •  PlatformBroadcastIntent: [more information needed]
    •  prid: [more information needed]
    •  pvp: The pvp game rule.
    •  rainLevel: [more information needed]
    •  rainTime: [more information needed]
    •  RandomSeed: Level seed.
    •  randomtickspeed: The randomtickspeed game rule.
    •  recipesunlock: The recipesunlock game rule.
    •  requiresCopiedPackRemovalCheck: [more information needed]
    •  respawnblocksexplode: The respawnblocksexplode game rule.
    •  sendcommandfeedback: The sendcommandfeedback game rule.
    •  serverChunkTickRange: Simulation distance.[more information needed]
    •  showbordereffect: The showbordereffect game rule.
    •  showcoordinates: The showcoordinates game rule.
    •  showdeathmessages: The showdeathmessages game rule.
    •  showtags: The showtags game rule.
    •  spawnMobs: 1 or 0 (true/false) - true if mobs can spawn.
    •  spawnradius: The spawnradius game rule.
    •  SpawnV1Villagers: Spawn pre-1.10.0 villagers.
    •  SpawnX: The X coordinate of the player's spawn position. Defaults to 0.
    •  SpawnY: The Y coordinate of the player's spawn position. Defaults to 64.
    •  SpawnZ: The Z coordinate of the player's spawn position. Defaults to 0.
    •  startWithMapEnabled: 1 or 0 (true/false) - true if new players spawn with a locator map.
    •  StorageVersion: Version of Bedrock Edition Storage Tool, currently is 8.
    •  texturePacksRequired: 1 or 0 (true/false) - true if the user must download the texture packs applied to the world to join.
    •  Time: Stores the current "time of day" in ticks. There are 20 ticks per real-life second, and 24000 ticks per Minecraft daylight cycle, making the full cycle length 20 minutes. 0 is the start of daytime, 12000 is the start of sunset, 13800 is the start of nighttime, 22200 is the start of sunrise, and 24000 is daytime again. The value stored in level.dat is always increasing and can be larger than 24000, but the "time of day" is always modulo 24000 of the "Time" field value.
    •  tntexplodes: The tntexplodes game rule.
    •  useMsaGamertagsOnly: Whether the world is restricted to Microsoft Accounts only (players must be signed in).
    •  world_policies: [more information needed]
    •  worldStartCount: Counts how many times the game has been closed since the world was created, with its value decreasing by 1 each time.
    •  XBLBroadcastIntent: [more information needed]

LOG[]

The LOG files are located at the /db path of a level, and are part of the leveldb format, used in between compaction of the LDB files. It is similar to a Log file for a program. The format is:

YYYY /MM/DD-Hour/Minute/Second.StepName "Info"

Example:

2014/07/24-22:20:08.400488 4a3638 Recovering log #3

History[]

Pocket Edition Alpha
v0.2.0level.dat is now a NBT formatted file.
player.dat information now moved to level.dat
Added entities.dat.
v0.3.2Entities.dat extended to store tile entity information.
v0.9.0build 1Added a new world save format, based on LevelDB 1.17 with Zlib compression support added. Older worlds are automatically converted to the new format when loaded.
Pocket Edition
1.0.0alpha 0.17.0.1Each sub chunk is now stored separately as a different leveldb key.
Bedrock Edition
1.2.13?Subchunks are now palleted.[1]

See also[]

References[]

Advertisement