Minecraft Wiki
Advertisement
Minecraft Wiki
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 wether there's anything out of date
Information icon.svg
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 2021). 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 Description
Dec Hex ASCII
44 2C , ChunkVersion A byte
45 2D - Data2D Biomes and elevation
46 2E . Data2DLegacy
47 2F / SubChunkPrefix Terrain for a 16×16×16 subchunk
48 30 0 LegacyTerrain Terrain for an entire chunk
49 31 1 BlockEntity Block entity data (little-endian NBT)
50 32 2 Entity Entity data (little-endian NBT)
51 33 3 PendingTicks Pending tick data (little-endian NBT)
52 34 4 BlockExtraData No longer Used
53 35 5 BiomeState
54 36 6 FinalizedState A 32-bit little endian integer
55 37 7 ? No longer used
56 38 8 BorderBlocks Education Edition Feature
57 39 9 HardCodedSpawnAreas Bounding boxes for structure spawns stored in binary format
58 3A : RandomTicks Random tick data (little-endian NBT)
59 3B ; Checksums xxHash checksums of other chunk records
118 76 v ChunkVersion A 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

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 NBT format.

NBT Structure[]

  • World data.
    •  abilities
      •  attackmobs
      •  attackplayers
      •  build
      •  doorsandswitches
      •  flying
      •  instabuild
      •  invulnerable
      •  lightning
      •  mayfly
      •  mine
      •  op
      •  opencontainers
      •  teleport
      •  permissionsLevel
      •  playerPermissionsLevel
      •  flySpeed
      •  walkSpeed
    •  lastOpenedWithVersion
    •  MinimumCompatibleClientVersion
    •  bonusChestEnabled
    •  bonusChestSpawned
    •  CenterMapsToOrigin
    •  commandblockoutput
    •  commandblocksenabled
    •  commandsEnabled
    •  ConfirmedPlatformLockedContent
    •  dodaylightcycle
    •  doentitiydrops
    •  dofiretick
    •  doimmediaterespawn
    •  doinsomnia
    •  domobloot
    •  domobspawning
    •  dotiledrops
    •  doweathercycle
    •  drowningdamage
    •  educationFeaturesEnabled
    •  experimentalgameplay
    •  falldamage
    •  firedamage
    •  ForceGameType
    •  hasBeenLoadedInCreative
    •  hasLockedBehaviorPack
    •  hasLockedResourcePack
    •  immutableWorld
    •  isFromLockedTemplate
    •  isFromWorldTemplate
    •  isWorldTemplateOptionLocked
    •  keepinventory
    •  LANBroadcast
    •  LANBroadcastIntent
    •  mobgriefing
    •  MultiplayerGame
    •  MultiplayerGameIntent
    •  naturalregeneration
    •  pvp
    •  requiresCopiedPackRemovalCheck
    •  sendcommandfeedback
    •  showcoordinates
    •  showdeathmessages
    •  showtags
    •  spawnMobs: Disable (0) or enable (1) mob spawning.
    •  SpawnV1Villagers: Spawn pre-1.10.0 villagers
    •  startWithMapEnabled
    •  texturePacksRequired
    •  tntexplodes
    •  useMsaGamertagsOnly
    •  Difficulty
    •  eduOffer
    •  functioncommandlimit
    •  Dimension: The dimension the player is in. 0 is the Overworld.
    •  GameType: Whether in survival (0), in creative (1), or in adventure (2) mode.
    •  Generator: World Type: Old (0), Infinite (1), or Flat (2).
    •  lightningTime
    •  LimitedWorldOriginX: X coordinate where limited (old) world generation started.
    •  LimitedWorldOriginY: Y coordinate where limited (old) world generation started.
    •  LimitedWorldOriginZ: Z coordinate where limited (old) world generation started.
    •  maxcommandchainlength
    •  NetherScale: Default is 8.
    •  NetworkVersion
    •  Platform: Seems to store the platform that the level is created on. Currently observed value is 2.
    •  PlatformBroadcastIntent
    •  rainTime
    •  randomtickspeed: Default is 1.
    •  serverChunkTickRange: Simulation distance
    •  spawnradius
    •  SpawnX: X coordinate of the player's spawn position. Default is 0.
    •  SpawnY: Y coordinate of the player's spawn position. Default is 64.
    •  SpawnZ: Z coordinate of the player's spawn position. Default is 0.
    •  StorageVersion:Version of Bedrock Edition Storage Tool, currently is 8.
    •  XBLBroadcastIntent
    •  currentTick
    •  LastPlayed: Stores the Unix time stamp (in seconds) when the player saved the game.
    •  RandomSeed: Level Seed
    •  Time: Stores the current "time of day" in ticks. There are 20 ticks per real-life second, and 14400 ticks per Minecraft day/night cycle, making the full cycle length 12 minutes—8 minutes shorter than the standard 20 minute day/night cycle. 0 is the start of daytime, 7200 is the start of sunset, 8280 is the start of nighttime, 13320 is the start of sunrise, and 14400 is daytime again. The value stored in level.dat is always increasing and can be larger than 14400, but the "time of day" is always modulo 14400 of the "Time" field value.
    •  worldStartCount
    •  lightningLevel
    •  rainLevel
    •  baseGameVersion
    •  FlatWorldLayers: JSON that controls generation of flat worlds. Default is {"biome_id":1,"block_layers":[{"block_data":0,"block_id":7,"count":1},{"block_data":0,"block_id":3,"count":2},{"block_data":0,"block_id":2,"count":1}],"encoding_version":3,"structure_options":null}
    •  InventoryVersion
    •  LevelName: Specifies the name of the level.
    •  prid

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.0?Added 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