Minecraft:Bedrock Edition level format
More actions
|
For the {{{Description}}} of the same name, see [[{{{Destination}}}]]. |
Template:Exclusive Template:Cleanup
Bedrock Edition uses a modified version of Google's LevelDB, which uses the Zlib compression format for Minecraft:world storage. The world storage files are located in a world file in Minecraft:com.mojang.
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, and the building instructions are documented by Tommaso at Template:Tweet.
For a Java implementation of LevelDB + Zlib, see https://github.com/HiveGamesOSS/leveldb-mcpe-java
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 compiles and functions 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 Minecraft:Nether, 2 for the Minecraft:End, omitted for the Minecraft: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 Minecraft:NBT which stores the lengths and the multi-byte integer types in little-endian format, as opposed to the big-endian format used by Template:El 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.
| Tag byte | Name | Structure | Description | ||
|---|---|---|---|---|---|
| Dec | Hex | ASCII | |||
| 43 | 2B | + |
Data3D | Heightmap (256×2 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 (256×2 bytes)
2D biomes (256×1 bytes) |
Biome IDs are written as 8-bit integers. No longer written since v1.18.0. |
| 46 | 2E | . |
Data2DLegacy | Heightmap (256×2 bytes)
2D biomes (256×4 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 (256×1 bytes) 2D biomes (256×4 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 | Minecraft:Block entity data (little-endian NBT) |
| 50 | 32 | 2 |
Entity | List of NBT compound roots | Minecraft:Entity data (little-endian NBT) |
| 51 | 33 | 3 |
PendingTicks | NBT compound root | 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 | NBT compound root | 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 |
| 119 | 77 | w
|
AABBVolumes | ||
Other keys
There's also the special key ~local_player for an entity data entry that holds the local player entity. The value associated with the ~local_player key is NBT encoded and has only 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 has only 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. Depending on the dimension, the village key is prefixed with VILLAGE_DIMENSION_[0-9a-f\\-]+_, with DIMENSION being replaced with the dimension's name.
- DWELLERS
- Consists mainly of an entity/mob ID's. Dwellers include villagers, iron golems, and cats.
- INFO
- Includes the village bounding box.
- POI
- Provides a mapping between villagers and their beds, village center (bell) and work station.
- PLAYERS
Other keys start with the following strings
- actorprefix
- digp
- map_
- portals
- schedulerWT
- structuretemplate
- tickingarea
- DynamicProperties
- scoreboard
- Overworld
- Nether
- TheEnd
- AutonomousEntities
- BiomeData
- mobevents
- LevelChunkMetaDataDictionary
- RealmsStoriesData_
- DedicatedServerForcedCorruption
- SST_SALOG
- SST_WORD
- SST_WORD_
An official explanation from Microsoft about how entities (actors) are stored in LevelDB can be found on Microsoft Learn / Minecraft Bedrock Edition.
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.
- A TypeScript implementation can be found on the mcbe-leveldb NPM package.
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 version of the file, which is currently 10. It is followed by another integer containing the length of the file, minus the header.
NBT Structure
- Template:Nbt: World data.
- Template:Nbt: The default permissions for players in the world.
- Template:Nbt: 1 or 0 (true/false) - true if the player can attack mobs.
- Template:Nbt: 1 or 0 (true/false) - true if the player can attack other players.
- Template:Nbt: 1 or 0 (true/false) - true if the player can place blocks.
- Template:Nbt: 1 or 0 (true/false) - true if the player is able to interact with redstone components.
- Template:Nbt: 1 or 0 (true/false) - true if the player is currently flying.
- Template:Nbt: The flying speed, always 0.05.
- Template:Nbt: 1 or 0 (true/false) - true if the player can instantly destroy blocks.
- Template:Nbt: 1 or 0 (true/false) - true if the player is immune to all damage and harmful effects.
- Template:Nbt: 1 or 0 (true/false) - true if the player was struck by lightning.
- Template:Nbt: 1 or 0 (true/false) - true if the player can fly.
- Template:Nbt: 1 or 0 (true/false) - true if the player can destroy blocks.
- Template:Nbt: 1 or 0 (true/false) - true if the player messages cannot be seen by other players.
- Template:Nbt: 1 or 0 (true/false) - true if the player can phase through blocks.
- Template:Nbt: 1 or 0 (true/false) - true if the player has operator commands.
- Template:Nbt: 1 or 0 (true/false) - true if the player is able to open containers.
- Template:Nbt: 1 or 0 (true/false) - true if the player is allowed to teleport.
- Template:Nbt: The vertical flight speed, always 1. Template:Info needed
- Template:Nbt: The walking speed, always 0.1.
- Template:Nbt: 1 or 0 (true/false) - true if the player is a world builder. (Removed 1.21.120 Template:Info needed)
- Template:Nbt: The
allowdestructiveobjectsMinecraft:game rule. Template:Info needed - Template:Nbt: The
allowmobsMinecraft:game rule. Template:Info needed - Template:Nbt: The version of Minecraft that is the maximum version to load resources from. Eg. setting this to
1.16.0removes any features that were added after version1.16.0. - Template:Nbt: Makes the world into a Minecraft:single biome world and the biome set here is the biome of this single biome world.
- Template:Nbt: 1 or 0 (true/false) - true if the bonus chest is enabled.
- Template:Nbt: 1 or 0 (true/false) - true if the bonus chest has been placed in the world. Turning this to false spawns another bonus chest near the spawn coordinates.
- Template:Nbt: Template:Info needed
- Template:Nbt: 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.
- Template:Nbt: 1 or 0 (true/false) - true if cheats are on.
- Template:Nbt: The
commandblockoutputMinecraft:game rule. - Template:Nbt: The
commandblocksenabledMinecraft:game rule. - Template:Nbt: Template:Info needed
- Template:Nbt: 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 allowed only on specific consoles.
- Template:Nbt: Template:Info needed
- Template:Nbt: Template:Info needed
- Template:Nbt: The current difficulty setting. 0 is Peaceful, 1 is Easy, 2 is Normal, and 3 is Hard.
- Template:Nbt: The dimension the player is in. 0 is the Overworld, 1 is the Nether, and 2 is the End. Template:Info needed
- Template:Nbt: The
dodaylightcycleMinecraft:game rule. - Template:Nbt: The
doentitiydropsMinecraft:game rule. - Template:Nbt: The
dofiretickMinecraft:game rule. - Template:Nbt: The
doimmediaterespawnMinecraft:game rule. - Template:Nbt: The
doinsomniaMinecraft:game rule. - Template:Nbt: The
dolimitedcraftingMinecraft:game rule. - Template:Nbt: The
domoblootMinecraft:game rule. - Template:Nbt: The
domobspawningMinecraft:game rule. - Template:Nbt: The
dotiledropsMinecraft:game rule. - Template:Nbt: The
doweathercycleMinecraft:game rule. - Template:Nbt: The
drowningdamageMinecraft:game rule. - Template:Nbt: The Minecraft:Editor world type. 0 is World, 1 is Project.
- Template:Nbt: Enables the
chemistryresource and behavior packs for the world, containing some features from Minecraft:Minecraft Education. - Template:Nbt: A Minecraft:UUID. Template:Info needed
- Template:Nbt: Template:Info needed
- Template:Nbt: Marks a world as a Minecraft:Minecraft Education world (worlds with this set to 1 do not open on Minecraft:Bedrock Edition!).
- Template:Nbt
- Template:Nbt: Unused in Bedrock Edition, but is used in Education Edition as part of the Resource Link feature on the Pause Screen. It defines the Resource Link Button Text.
- Template:Nbt: Unused in Bedrock Edition, but is used in Education Edition as part of the Resource Link feature on the Pause Screen. It defines what link opens upon clicking the Resource Link Button.
- Template:Nbt
- Template:Nbt: 1 or 0 (true/false) - true if the world is locked on Minecraft:experimental gameplay.
- Template:Nbt: 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.
- Template:Nbt: The
falldamageMinecraft:game rule. - Template:Nbt: The
firedamageMinecraft:game rule. - Template:Nbt: JSON that controls generation of flat worlds. The
block_layersarray must contain at least 2 valid blocks, otherwise the world will generate as void. Default is{"biome_id":1,"block_layers":[{"block_name":"minecraft:bedrock","count":1},{"block_name":"minecraft:dirt","count":2},{"block_name":"minecraft:grass_block","count":1}],"encoding_version":6,"preset_id":"ClassicFlat","structure_options":null,"world_version":"version.post_1_18"}. - Template:Nbt: The
globalmuteMinecraft:game rule. Template:Info needed - Template:Nbt: 1 or 0 (true/false) - true if force the player into the game mode defined in
GameType. - Template:Nbt: The
freezedamageMinecraft:game rule. - Template:Nbt: The
functioncommandlimitMinecraft:game rule. - Template:Nbt: The default game mode of the player. 0 is Minecraft:Survival, 1 is Minecraft:Creative, 2 is Minecraft:Adventure, 5 is Default, and 6 is Minecraft:Spectator.
- Template:Nbt: The world type. 0 is Minecraft:Old, 1 is Infinite, 2 is Minecraft:Flat, 5 is Void, and others are Infinite with the bedrock layer at 0.
- Template:Nbt: Whether the world has Minecraft:achievements locked. Set to 1 if the default game mode is set to Creative, if cheats have been enabled, or if a behavior pack has been equipped.
- Template:Nbt: Template:Info needed
- Template:Nbt: Template:Info needed
- Template:Nbt: Template:Info needed
- Template:Nbt: Is read-only.
- Template:Nbt: Template:Info needed
- Template:Nbt: 1 or 0 (true/false) - true if it was created from the Minecraft:Bedrock Editor.
- Template:Nbt: 1 or 0 (true/false) - true if exported from the Bedrock Editor.
- Template:Nbt: 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.
- Template:Nbt: 1 or 0 (true/false) - true if the world is created from a Minecraft:world template.
- Template:Nbt: 1 or 0 (true/false) - true if the world is in Minecraft:Hardcore mode.
- Template:Nbt: 1 or 0 (true/false) - true if the world template generates with a new, random seed.
- Template:Nbt: 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.
- Template:Nbt: 1 or 0 (true/false) - true if the world options cannot be modified until the user accepts that they are changing the map.
- Template:Nbt: The
keepinventoryMinecraft:game rule. - Template:Nbt: Whether the world has been opened with the "Visible to LAN players" world setting enabled.
- Template:Nbt: Whether the "Visible to LAN players" world toggle is enabled.
- Template:Nbt: Five Template:Nbts 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. - Template:Nbt: Stores a timestamp of when the world was last played as the number of seconds since the epoch (1/1/1970).
- Template:Nbt: Specifies the name of the world.
- Template:Nbt: Related to the current strength of Minecraft:thunderstorms.Template:Info needed
- Template:Nbt: Template:Info neededRelated to the Minecraft:weather cycle regarding thunderstorms.
- Template:Nbt: The X coordinate where limited (old) world generation started.
- Template:Nbt: The Y coordinate where limited (old) world generation started.
- Template:Nbt: The Z coordinate where limited (old) world generation started.
- Template:Nbt: The width (in chunks) of the borders surrounding the (old) world generation. Defaults to 16.
- Template:Nbt: The depth (in chunks) of the borders surrounding the (old) world generation. Defaults to 16.
- Template:Nbt: The
locatorbarMinecraft:game rule. - Template:Nbt: The
maxcommandchainlengthMinecraft:game rule. - Template:Nbt: Five Template:Nbts 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. - Template:Nbt: The
mobgriefingMinecraft:game rule. - Template:Nbt: Whether the world has been opened with the "Multiplayer Game" world setting enabled.
- Template:Nbt: Whether the "Multiplayer Game" world toggle is enabled.
- Template:Nbt: The
naturalregenerationMinecraft:game rule. - Template:Nbt: 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).
- Template:Nbt: The protocol version of the version the world was last played on.
- Template:Nbt: What permissions a player defaults to, when joining a world.
- Template:Nbt: Seems to store the platform that the level is created on. Currently observed value is 2.
- Template:Nbt: Template:Info needed
- Template:Nbt: 1 or 0 (true/false) - true if a player has died.Template:Info needed
- Template:Nbt: What permissions a player has.
- Template:Nbt: The
playersleepingpercentageMinecraft:game rule, values above 100 mean that night will never turn into day. - Template:Nbt: The UUID of the premium world template this world was created with. Used for Marketplace worlds.Template:Info needed
- Template:Nbt: The
projectilescanbreakblocksMinecraft:game rule. - Template:Nbt: The
pvpMinecraft:game rule. - Template:Nbt: Related to the current strength of Minecraft:rain.Template:Info needed
- Template:Nbt: Related to the Minecraft:weather cycle regarding rain.Template:Info needed
- Template:Nbt: Level seed.
- Template:Nbt: The
randomtickspeedMinecraft:game rule. - Template:Nbt: The
recipesunlockMinecraft:game rule. - Template:Nbt: Template:Info needed
- Template:Nbt: The
respawnblocksexplodeMinecraft:game rule. - Template:Nbt: The
sendcommandfeedbackMinecraft:game rule. - Template:Nbt: Simulation distance.Template:Info needed
- Template:Nbt: The
showbordereffectMinecraft:game rule. - Template:Nbt: The
showcoordinatesMinecraft:game rule. - Template:Nbt: The
showdaysplayedMinecraft:game rule. - Template:Nbt: The
showdeathmessagesMinecraft:game rule. - Template:Nbt: The
showrecipemessagesMinecraft:game rule. - Template:Nbt: The
showtagsMinecraft:game rule. - Template:Nbt: 1 or 0 (true/false) - true if mobs can spawn.
- Template:Nbt: The
spawnradiusMinecraft:game rule. - Template:Nbt: Spawn pre-1.10.0 villagers.
- Template:Nbt: The X coordinate of the player's spawn position. Defaults to 0.
- Template:Nbt: The Y coordinate of the player's spawn position. Defaults to 64.
- Template:Nbt: The Z coordinate of the player's spawn position. Defaults to 0.
- Template:Nbt: 1 or 0 (true/false) - true if new players spawn with a locator map.
- Template:Nbt: Version of Bedrock Edition Storage Tool, currently is 10.
- Template:Nbt: 1 or 0 (true/false) - true if the user must download the texture packs applied to the world to join.
- Template:Nbt: Stores the current "time of day" in ticks. There are 20 ticks per real-life second, and 24000 ticks per Minecraft 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.
- Template:Nbt: The
tntexplodesMinecraft:game rule. - Template:Nbt: The
tntexplosiondropdecayMinecraft:game rule. - Template:Nbt: Whether the world is restricted to Microsoft Accounts only (players must be signed in).
- Template:Nbt: Template:Info needed
- Template:Nbt: Counts how many times the game has been closed since the world was created, with its value decreasing by 1 each time.
- Template:Nbt: Template:Info needed
- Template:Nbt: The Minecraft:multiplayer exposure for the Xbox friends system, corresponding to the "Microsoft Account Settings" world setting. 0 is disabled, 1 is "Invite Only," 2 is "Friends Only," and 3 is "Friends of Friends."
- Template:Nbt: The default permissions for players in the world.
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
See also
References
Template:Navbox Bedrock Edition
Minecraft:de:Spielstand-Speicherung (Bedrock) Minecraft:es:Formato de nivel de Bedrock Edition Minecraft:ja:Levelフォーマット/Bedrock Edition Minecraft:nl:Bedrockeditie level format Minecraft:pt:Formato de nível da Edição Bedrock Minecraft:zh:基岩版存档格式