🗃️ Understanding Bedrock Edition Database Architecture
Minecraft Bedrock Edition uses a completely different storage system compared to Java Edition. Instead of Anvil region files, Bedrock uses Google's LevelDB database with Mojang-specific modifications including Zlib compression and Windows support. This exclusive Bedrock Edition feature enables cross-platform compatibility and efficient data access patterns.
LevelDB Database System
Key-value storage with modified LevelDB and Zlib compression
Chunk Key Format
Complex key structure with coordinates and type tags
Little-Endian NBT
NBT format with little-endian byte ordering
Cross-Platform Support
Optimized for mobile, console, and Windows platforms
🗄️ LevelDB Database Format
Bedrock Edition uses Mojang's modified version of Google's LevelDB for efficient world data storage.
📍 Database Location
The LevelDB database is stored in the db/
subdirectory of each Bedrock world:
worlds/YourWorldName/db/
Important: The database path passed to LevelDB API is the directory path, not any specific file within it.
🔧 Mojang Modifications
- Zlib Compression: Added compression for efficient storage
- Windows Support: Cross-platform compatibility
- Custom Key Format: Specialized chunk addressing system
- Little-Endian NBT: Modified NBT byte ordering
Source Code: Available at github.com/Mojang/leveldb
🔄 Data Organization
LevelDB uses a key-value store where:
- Keys: Contain chunk coordinates, dimension, and data type
- Values: Store actual chunk data, entities, or metadata
- Compression: Zlib compression for space efficiency
- Indexing: Fast random access to specific chunks
🔑 Chunk Key Format System
Understanding the binary key structure used to identify and access chunk data in the LevelDB database.
📊 Key Components
1. Chunk Coordinates
Two signed 32-bit little-endian integers
X coordinate (4 bytes) + Z coordinate (4 bytes)
2. Dimension ID (Optional)
32-bit little-endian integer
Omitted for Overworld, 1 for Nether, 2 for End
3. Record Type Tag
One-byte tag specifying data type
See key type tags table below
4. Subchunk Index (Optional)
One byte for SubChunkPrefix records
Values from 0 to 15 for different height levels
🔢 Key Lengths
- 9 bytes: Overworld chunks (8 bytes coords + 1 byte type)
- 10 bytes: Overworld subchunks (9 bytes + 1 byte index)
- 13 bytes: Other dimension chunks (12 bytes + 1 byte type)
- 14 bytes: Other dimension subchunks (13 bytes + 1 byte index)
🏷️ Chunk Key Type Tags
Complete reference of all record type tags used in Bedrock Edition chunk keys.
Terrain & Biome Data
6 typesDec | Hex | ASCII | Name | Description |
---|---|---|---|---|
43 | 2B | + | Data3D | Heightmap (256×2 bytes) and biome data (varying lengths). Biomes stored as 25 palettes, IDs as integers |
44 | 2C | , | Version | 1 byte version identifier - 0 for old worlds, higher values for infinite worlds |
45 | 2D | - | Data2D | Heightmap (256×2 bytes) and 2D biomes (256×1 bytes). Biome IDs as 8-bit integers. No longer written since v1.18.0 |
46 | 2E | . | Data2DLegacy | Heightmap (256×2 bytes) and 2D biomes (256×4 bytes). Biome ID in first byte, RGB in final 3 bytes. No longer written since v1.0.0 |
47 | 2F | / | SubChunkPrefix | Subchunk version (1 byte) + version-dependent data. Terrain for 16×16×16 subchunk |
48 | 30 | 0 | LegacyTerrain | Block IDs (32768 bytes), meta (32768 nibbles), sky/block light (32768 nibbles each), heightmap (256×1 bytes), 2D biomes (256×4 bytes). Data in XZY order. No longer written since v1.0.0 |
Entity & Block Entity Data
4 typesDec | Hex | ASCII | Name | Description |
---|---|---|---|---|
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) |
58 | 3A | : | RandomTicks | List of NBT compound roots - random tick data (little-endian NBT) |
World State & Features
11 typesDec | Hex | ASCII | Name | Description |
---|---|---|---|---|
52 | 34 | 4 | LegacyBlockExtraData | Entry count (4 bytes) + entries (Key 4 bytes, Value 2 bytes). Used for grass in snow layers prior to v1.2.13. No longer written as of v1.2.13 |
53 | 35 | 5 | BiomeState | Biome state information for chunk generation |
54 | 36 | 6 | FinalizedState | 4 bytes - A 32-bit little endian integer indicating finalization status |
56 | 38 | 8 | BorderBlocks | Education Edition Feature - border block data |
57 | 39 | 9 | HardcodedSpawners | Bounding boxes for structure spawns stored in binary format |
59 | 3B | ; | Checksums | xxHash checksums of other chunk records. No longer written as of v1.18.0 |
61 | 3D | = | MetaDataHash | Metadata hash for chunk verification |
62 | 3E | > | GeneratedPreCavesAndCliffsBlending | Pre-Caves and Cliffs blending data - Not used |
63 | 3F | ? | BlendingBiomeHeight | Biome height blending data - Not used |
64 | 40 | @ | BlendingData | World blending data for terrain generation transitions |
65 | 41 | A | ActorDigestVersion | Actor digest version for entity processing optimization |
Legacy & Deprecated Records
2 typesDec | Hex | ASCII | Name | Description |
---|---|---|---|---|
55 | 37 | 7 | ConversionData | World conversion data - No longer used |
118 | 76 | v | LegacyVersion | 1 byte legacy version - moved to tag 44 in v1.16.100 |
🎯 Special Database Keys
Non-chunk keys used for player data, world settings, and game features.
Player Data Keys
2 keys~local_player
Local player entity data with single NBT compound root
player_
Remote player data with client ID from clientid.txt file (e.g., player_-12345678)
World Data Keys
9 keysgame_flatworldlayers
Flat world layer configuration in ASCII format (length 20, e.g., "[7,3,3,2]" with length 9)
map_<#>
Map item data for individual maps
portals
Nether portal linkage and coordinate data
structuretemplate
Structure template data for generated structures
tickingarea
Ticking area definitions and boundaries
actorprefix*
Actor/entity prefix keys for entity management
digp*
Dig persistence data for world interactions
map_*
Map data prefixes for cartography
schedulerWT*
Scheduler world tick data for timed events
Village System Keys
4 keysVILLAGE__DWELLERS
Village dwellers including villagers, iron golems, and cats
VILLAGE__INFO
Village information including bounding boxes and properties
VILLAGE__POI
Point of interest mapping between villagers and their beds/workstations
VILLAGE__PLAYERS
Player interactions and reputation data with villages
📄 level.dat File Structure
The level.dat file in Bedrock Edition uses uncompressed NBT format with little-endian byte ordering and an 8-byte header.
📋 File Header Format
🗂️ NBT Data Fields
Player Abilities & Permissions
8 fieldsattackmobs
1 or 0 (true/false) - true if player can attack mobs
attackplayers
1 or 0 (true/false) - true if player can attack other players
build
1 or 0 (true/false) - true if player can place blocks
doorsandswitches
1 or 0 (true/false) - true if player can interact with redstone
flying
1 or 0 (true/false) - true if player is currently flying
mayfly
1 or 0 (true/false) - true if player can fly
mine
1 or 0 (true/false) - true if player can destroy blocks
op
1 or 0 (true/false) - true if player has operator commands
World Settings & Generation
7 fieldsGenerator
World type: 0=Old, 1=Infinite, 2=Flat
RandomSeed
World generation seed
Difficulty
0=Peaceful, 1=Easy, 2=Normal, 3=Hard
GameType
0=Survival, 1=Creative, 2=Adventure, 3=Spectator
commandsEnabled
1 or 0 (true/false) - true if cheats are enabled
bonusChestEnabled
1 or 0 (true/false) - true if bonus chest is enabled
spawnMobs
1 or 0 (true/false) - true if mobs can spawn
Spawn Coordinates & Dimensions
4 fieldsSpawnX
X coordinate of player spawn position (defaults to 0)
SpawnY
Y coordinate of player spawn position (defaults to 64)
SpawnZ
Z coordinate of player spawn position (defaults to 0)
Dimension
Current dimension: 0=Overworld, 1=Nether, 2=End
Game Rules & Mechanics
8 fieldskeepinventory
Keep inventory on death game rule
mobgriefing
Mob griefing game rule
dodaylightcycle
Daylight cycle game rule
dofiretick
Fire tick game rule
domobspawning
Mob spawning game rule
doweathercycle
Weather cycle game rule
naturalregeneration
Natural regeneration game rule
pvp
Player vs player game rule
Time & Weather Data
7 fieldsTime
Current time of day in ticks (24000 ticks = 1 day cycle)
currentTick
Current game tick counter
LastPlayed
64-bit Q32.32 Unix timestamp of when world was last played
rainLevel
Current rain intensity level
rainTime
Ticks remaining for current rain state
lightningLevel
Current lightning intensity level
lightningTime
Ticks remaining for current lightning state
Version & Compatibility
5 fieldsStorageVersion
Bedrock Edition storage tool version (currently 10)
NetworkVersion
Protocol version of last played version
baseGameVersion
Maximum version to load resources from (e.g., 1.16.0 removes newer features)
lastOpenedWithVersion
Five integers representing last opened version (e.g., [1, 20, 30, 22, 1])
MinimumCompatibleClientVersion
Five integers for minimum compatible client version (e.g., [1, 20, 30, 0, 0])
Education Edition Features
6 fieldseducationFeaturesEnabled
1 or 0 (true/false) - true if Education Edition features are enabled
EducationOid
UUID for Education Edition organization identifier
EducationProductId
Product identifier for Education Edition licensing
eduOffer
Education Edition world marker (worlds with 1 do not open on Bedrock!)
codebuilder
Code Builder/MakeCode integration status
immutableWorld
1 or 0 (true/false) - true if world is read-only
Experimental Features
3 fieldsexperiments_ever_used
1 or 0 (true/false) - true if world has experimental gameplay locked
saved_with_toggled_experiments
1 or 0 (true/false) - true if world has been saved with experiments before
enabled_features
List of experimental features enabled for this world
Multiplayer & Network Settings
8 fieldsMultiplayerGame
1 or 0 (true/false) - true if "Multiplayer Game" world setting enabled
MultiplayerGameIntent
1 or 0 (true/false) - true if "Multiplayer Game" toggle enabled
LANBroadcast
1 or 0 (true/false) - true if "Visible to LAN players" enabled
LANBroadcastIntent
1 or 0 (true/false) - true if "Visible to LAN players" toggle enabled
XBLBroadcastIntent
Xbox Live multiplayer exposure: 0=disabled, 1=Invite Only, 2=Friends Only, 3=Friends of Friends
useMsaGamertagsOnly
1 or 0 (true/false) - true if restricted to Microsoft Accounts only
Platform
Platform identifier (observed value: 2)
PlatformBroadcastIntent
Platform-specific broadcast settings
World Templates & Marketplace
8 fieldsisFromWorldTemplate
1 or 0 (true/false) - true if world created from template
isFromLockedTemplate
1 or 0 (true/false) - true if created from locked template with unmodifiable options
isWorldTemplateOptionLocked
1 or 0 (true/false) - true if world options locked until user accepts changes
prid
UUID of premium world template for Marketplace worlds
hasLockedBehaviorPack
Behavior pack lock status
hasLockedResourcePack
Resource pack lock status
texturePacksRequired
1 or 0 (true/false) - true if texture packs required to join
ConfirmedPlatformLockedContent
1 or 0 (true/false) - true if world has platform-specific content
Advanced World Settings
8 fieldsNetherScale
Nether coordinate scale (defaults to 8): X nether blocks = 1 overworld block
worldStartCount
Counts game closures since world creation (decreases by 1 each closure)
serverChunkTickRange
Simulation distance for chunk processing
CenterMapsToOrigin
1 or 0 (true/false) - true if maps centered to grid origin
startWithMapEnabled
1 or 0 (true/false) - true if new players spawn with locator map
SpawnV1Villagers
1 or 0 (true/false) - spawn pre-1.10.0 villagers
isCreatedInEditor
1 or 0 (true/false) - true if created from Bedrock editor
isExportedFromEditor
1 or 0 (true/false) - true if exported from Bedrock editor
Special Data Structures
7 fieldsFlatWorldLayers
JSON controlling flat world generation
BiomeOverride
Makes world single-biome with specified biome ID
InventoryVersion
Inventory system version identifier
world_policies
World-specific policy settings
eduSharedResource
Education Edition shared resource configuration with buttonName and linkUri
IsHardcore
1 or 0 (true/false) - true if world in Hardcore mode
IsSingleUseWorld
1 or 0 (true/false) - unused, may cause world deletion after use
🔄 NBT Format Differences
Key differences between Bedrock Edition and Java Edition NBT data formats.
🔵 Bedrock Edition NBT
- Byte Order: Little-endian
- Integer Storage: Multi-byte integers in little-endian
- String Lengths: Little-endian length prefixes
- Compression: Zlib compression in database
- Usage: Entity, BlockEntity, PendingTicks records
🟠 Java Edition NBT
- Byte Order: Big-endian
- Integer Storage: Multi-byte integers in big-endian
- String Lengths: Big-endian length prefixes
- Compression: Gzip compression for region files
- Usage: Anvil region files and level.dat
⚠️ Conversion Warning
NBT data is not directly compatible between Java and Bedrock editions due to byte ordering differences. Specialized conversion tools are required for cross-platform world transfers.
🛠️ Developer Tools & Resources
Essential tools and libraries for working with Bedrock Edition level format and LevelDB databases.
LevelDB Libraries
Programming libraries for LevelDB access:
- Mojang LevelDB: Official modified version with Zlib
- leveldb-mcpe-java: Java implementation with compression
- Python leveldb: Python bindings for database access
- Node.js leveldown: JavaScript LevelDB bindings
World Editors
Tools for editing Bedrock worlds:
- Amulet Editor: Cross-platform world editor
- MCC Tool Chest: Bedrock-specific editor
- Blocktopograph: Mobile world viewer/editor
- Universal Minecraft Editor: Multi-format editor
Analysis Tools
Database inspection and debugging:
- LevelDB dump: Database content exploration
- NBT parsers: Little-endian NBT readers
- Chunk analyzers: Key format decoders
- Performance profilers: Database optimization tools
Conversion Utilities
Format conversion and migration:
- Java to Bedrock converters: Cross-edition world transfer
- NBT format converters: Endianness conversion
- Structure exporters: Cross-platform building
- World optimizers: Database cleanup and repair
📋 LOG Files Format
LevelDB generates LOG files in the db/ directory for database operations and compaction processes.
📍 File Location
LOG files are located at the /db
path of a Bedrock world:
worlds/YourWorldName/db/LOG
worlds/YourWorldName/db/LOG.old
Purpose: Part of LevelDB format, used between compaction of LDB files
📄 Log Format
Each log entry follows a structured format:
YYYY/MM/DD-Hour:Minute:Second.Microseconds ProcessID "Operation"
Components:
- Date/Time: When the operation occurred
- Process ID: Hexadecimal process identifier
- Operation: Description of database operation
📊 Example Log Entries
2014/07/24-22:20:08.400488 4a3638 Recovering log #3
Database recovery operation
2024/09/04-11:45:12.123456 2f1a8c Compaction started
Database compaction process beginning
2024/09/04-11:45:15.789012 2f1a8c Level-0 compaction finished
Compaction process completion
🔧 Common Operations
- Recovering log: Database startup and recovery
- Compaction: Database optimization and cleanup
- Level operations: LSM-tree level management
- File operations: SSTable file creation/deletion
- Manifest updates: Database metadata changes
🛠️ Troubleshooting with LOG Files
🔍 Corruption Detection
Look for error messages about corrupted blocks or invalid checksums
⚠️ Recovery Issues
Check for "Recovering log" entries that don't complete successfully
💾 Space Problems
Monitor compaction operations for disk space or performance issues
🔒 Lock Problems
Identify database locking issues preventing world access
✅ Best Practices & Safety Guidelines
Essential safety practices when working with Bedrock Edition world databases and level files.
Safety First
- Always backup worlds before any modifications
- Test changes on world copies, not originals
- Verify tools compatibility with your Bedrock version
- Close Minecraft completely before database editing
- Check file integrity after modifications
Technical Guidelines
- Use correct endianness for NBT data reading/writing
- Maintain key format when adding new chunk data
- Handle compression properly for Zlib-compressed values
- Respect version compatibility between Bedrock releases
- Validate chunk coordinates and dimension IDs
Performance Tips
- Batch database operations for efficiency
- Close database connections properly after use
- Monitor database size and perform cleanup
- Use appropriate tools for large-scale operations
- Test performance impact of modifications
🔄 Version Compatibility
Bedrock Edition's level format evolves with updates. Always check compatibility between your tools, the world's storage version, and the current Bedrock Edition version. Some features and key types are version-specific and may not work across all versions.