Java Edition level format

This feature is exclusive to Java Edition.
 

Each level is its own folder. A level folder is often identified by having a level.dat file, along with other subfolders to store the maps and regions of the level.

Directory structure

This is the directory structure of the .minecraft/saves folder, where the game saves the entire world data:

  • File directory.png: Sprite image for directory in Minecraft: A world directory.
    • File file.png: Sprite image for file in Minecraft level.dat: Stores global information about the level. See below.
    • File file.png: Sprite image for file in Minecraft level.dat_new: Program writes new global information about the level, and after that file is renamed to level.dat.
    • File file.png: Sprite image for file in Minecraft level.dat_old: A backup of the previous level.dat file.
    • File file.png: Sprite image for file in Minecraft session.lock: Used to give write access to the last program to modify this file. See below.
    • File directory.png: Sprite image for directory in Minecraft playerdata: Stores the individual states of the players that have played on this level, since 1.7.6.
    • File directory.png: Sprite image for directory in Minecraft stats: Stores the statistics of the players that have played on this level, since 1.7.2.
    • File directory.png: Sprite image for directory in Minecraft advancements: Stores the advancements and unlocked recipes of the players that have played on this level, since 17w13a.
    • File directory.png: Sprite image for directory in Minecraft data: Miscellaneous data of the world.
    • File directory.png: Sprite image for directory in Minecraft region: Stores region files of Overworld.
    • File directory.png: Sprite image for directory in Minecraft entities: Contains entity files for the Overworld. These used to be part of region.
      • File file.png: Sprite image for file in Minecraft r.<x>.<y>.mca: A region file of entities.
    • File directory.png: Sprite image for directory in Minecraft poi: Villager identified beds, job sites, and bells in the Overworld. Nether portals, bee nests, bee hives, and lodestones also use this.
      • File file.png: Sprite image for file in Minecraft r.<x>.<y>.mca: A region file of points of interests. See below.
    • File directory.png: Sprite image for directory in Minecraft DIM-1: Contains region files of the Nether.
      • File directory.png: Sprite image for directory in Minecraft data: Miscellaneous data of the Nether.
        • File file.png: Sprite image for file in Minecraft raids_nether.dat: Stores information about the ongoing raids in the Nether.
      • File directory.png: Sprite image for directory in Minecraft region: See above.
      • File directory.png: Sprite image for directory in Minecraft entities: See above.
      • File directory.png: Sprite image for directory in Minecraft poi: See above.
    • File directory.png: Sprite image for directory in Minecraft DIM1: Contains region files of the End.
      • File directory.png: Sprite image for directory in Minecraft data: Miscellaneous data of the End.
        • File file.png: Sprite image for file in Minecraft raids_end.dat: Stores information about the ongoing raids in the End.
      • File directory.png: Sprite image for directory in Minecraft region: See above.
      • File directory.png: Sprite image for directory in Minecraft entities: See above.
      • File directory.png: Sprite image for directory in Minecraft poi: See above.
    • File directory.png: Sprite image for directory in Minecraft datapacks: Stores the world's data packs.
      • File archive.png: Sprite image for archive in MinecraftFile directory.png: Sprite image for directory in Minecraft <datapack>: A data pack.
    • File directory.png: Sprite image for directory in Minecraft dimensions: Contains region files of non-vanilla dimensions, added by data packs or mods
      • File directory.png: Sprite image for directory in Minecraft <namespace>: Namespace of the defined dimension.
        • File directory.png: Sprite image for directory in Minecraft <path>: Path of the defined dimension.
          • File directory.png: Sprite image for directory in Minecraft data: Miscellaneous data of the custom dimension.
            • File file.png: Sprite image for file in Minecraft raids.dat: Stores information about the ongoing raids in this dimension.
          • File directory.png: Sprite image for directory in Minecraft region: See above.
          • File directory.png: Sprite image for directory in Minecraft entities: See above.
          • File directory.png: Sprite image for directory in Minecraft poi: See above.
    • File archive.png: Sprite image for archive in Minecraft resources.zip: A resource pack applied when the world loads in.

Deprecated

  • File directory.png: Sprite image for directory in Minecraft: A world directory.
    • File file.png: Sprite image for file in Minecraft level.dat_mcr: A backup of the level.dat file before conversion from MCRegion to Anvil.
    • File directory.png: Sprite image for directory in Minecraft players: Stores the individual states of the players that have played on this level, for versions before 1.7.6.
    • File directory.png: Sprite image for directory in Minecraft data: Miscellaneous data of the world.
      • File file.png: Sprite image for file in Minecraft villages.dat: Stores information about the villages in the world. The "nether" and "end" files have been added in 1.8. Replaced by point of interest region files in 1.14.
      • File file.png: Sprite image for file in Minecraft villages_nether.dat: See above.
      • File file.png: Sprite image for file in Minecraft villages_end.dat: See above.
    • File directory.png: Sprite image for directory in Minecraft region: Backups of the region files before conversion from MCRegion to Anvil.
    • File directory.png: Sprite image for directory in Minecraft DIM-1: See above.
    • File directory.png: Sprite image for directory in Minecraft DIM1: See above.
    • File directory.png: Sprite image for directory in Minecraft <#>
      • File directory.png: Sprite image for directory in Minecraft <#>

level.dat format

The level.dat file contains global information about the world such as the time of day, the singleplayer player, the level generator used, and the seed. When a world is loaded, the current level.dat is backed up to level.dat_old. It is an NBT file with this structure:

  • [NBT Compound / JSON Object] The root tag.
    • [NBT Compound / JSON Object] Data: This tag contains all the level data.
      • [Boolean] allowCommands: 1 or 0 (true/false) - true if cheats are enabled.
      • [Double] BorderCenterX: Center of the world border on the X coordinate. Defaults to 0.
      • [Double] BorderCenterZ: Center of the world border on the Z coordinate. Defaults to 0.
      • [Double] BorderDamagePerBlock: Defaults to 0.2.
      • [Double] BorderSize: Width and length of the border of the world. Defaults to 60000000.
      • [Double] BorderSafeZone: Defaults to 5.
      • [Double] BorderSizeLerpTarget: Defaults to 60000000.
      • [Long] BorderSizeLerpTime: Defaults to 0.
      • [Double] BorderWarningBlocks: Defaults to 5.
      • [Double] BorderWarningTime: Defaults to 15.
      • [Int] clearWeatherTime: The number of ticks until "clear weather" has ended.
      • [NBT Compound / JSON Object] CustomBossEvents: A collection of bossbars.
        • [NBT Compound / JSON Object] ID: The ID of a bossbar (e.g. custom:boss)
          • [NBT List / JSON Array] Players: A list of players that may see this boss bar.
          • [String] Color: ID of the color of the bossbar. Also sets the color of the display text of the bossbar, provided that the display text does not explicitly define a color for itself. See color codes for accepted values.
          • [Boolean] CreateWorldFog: 1 or 0 (true/false) - If the bossbar should create fog.
          • [Boolean] DarkenScreen: 1 or 0 (true/false) - If the bossbar should darken the sky.
          • [Int] Max: The maximum health of the bossbar.
          • [Int] Value: The current health of the bossbar.
          • [String] Name: The display name of the bossbar as a JSON text component.
          • [String] Overlay: The ID of the overlay to be shown over the health bar. Accepted values are: progress, notched_6, notched_10, notched_12, and notched_20.
          • [Boolean] PlayBossMusic: 1 or 0 (true/false) - If the bossbar should initiate boss music.
          • [Boolean] Visible: 1 or 0 (true/false) - If the bossbar should be visible to the listed players.
      • [NBT Compound / JSON Object] DataPacks: Options for data packs.
        • [NBT List / JSON Array] Disabled: List of disabled data packs.
          • [String]: A single data pack.
        • [NBT List / JSON Array] Enabled: List of enabled data packs. By default, this is populated with a single string "vanilla".
          • [String]: A single data pack.
      • [Int] DataVersion: An integer displaying the data version.
      • [Long] DayTime: The time of day. 0 is sunrise, 6000 is mid day, 12000 is sunset, 18000 is mid night, 24000 is the next day's 0. This value keeps counting past 24000 and does not reset to 0.
      • [Byte] Difficulty: The current difficulty setting. 0 is Peaceful, 1 is Easy, 2 is Normal, and 3 is Hard. Defaults to 2.
      • [Boolean] DifficultyLocked: 1 or 0 (true/false) - True if the difficulty has been locked. Defaults to 0.
      • [NBT Compound / JSON Object] DimensionData: This tag contains level data specific to certain dimensions.
        • [NBT Compound / JSON Object] 1: Data for the End.
          • [NBT Compound / JSON Object] DragonFight: Data for the ender dragon fight. Appears only after the End is entered.
            • [NBT Compound / JSON Object] ExitPortalLocation: Location of the End's exit portal that the ender dragon flies to upon its death.
              • [Byte] X: The X coordinate of the portal.
              • [Byte] Y: The Y coordinate of the portal.
              • [Byte] Z: The Z coordinate of the portal.
            • [NBT List / JSON Array] Gateways: Contains a list of locations of the end gateway portals that haven't been spawned.
              • [Int]: The angle of a future gateway, from 0 to 19. 0 is east of the exit portal, and numbers increase clockwise.
            • [Boolean] DragonKilled: 1 or 0 (true/false) - If the dragon is currently alive.
            • [Long] DragonUUIDLeast: The least significant bits of the current ender dragon's Universally Unique IDentifier. This is joined with DragonUUIDMost to form the dragon's unique ID.
            • [Long] DragonUUIDMost: The most significant bits of the current ender dragon's Universally Unique IDentifier. This is joined with DragonUUIDLeast to form the dragon's unique ID.
            • [Boolean] PreviouslyKilled: 1 or 0 (true/false) - If the ender dragon has ever been defeated. Used to determine how much XP is given by dragon and whether to spawn a Dragon Egg.
      • [NBT List / JSON Array] enabled_features: List of experimental features enabled for this world. Doesn't appear if there are no experimental features enabled.
        • [String]: A single experimental feature.
      • [NBT Compound / JSON Object] GameRules: The gamerules used in the world.
        • [String] Rule name: The value for the given rule. This is always an NBT string, which is either true or false for the majority of rules (with it being a number for some other rules, and any arbitrary string for a user-defined rule)
      • [NBT Compound / JSON Object] WorldGenSettings: Used in 1.16, the generation settings for each dimension.
        • [Boolean] bonus_chest: 1 or 0 (true/false) - Used to determine if the bonus chest should appear near the spawn point when a world is first entered. Available only in singleplayer.
        • [Long] seed: The numerical seed of the world.
        • [Boolean] generate_features: 1 or 0 (true/false) - Whether structures should be generated or not.
        • [NBT Compound / JSON Object] dimensions: Contains all the dimensions.
      • [Int] GameType: The default game mode for the singleplayer player when they initially spawn. 0 is Survival, 1 is Creative, 2 is Adventure, 3 is Spectator. Note: singleplayer worlds do not use this field to save which game mode the player is currently in.
      • [String] generatorName: Used in 1.15 and below. The name of the generator; default, flat, largeBiomes, amplified, buffet, debug_all_block_states or default_1_1. Not case sensitive, but always written in the case here. The last one can exist only if the file was edited. It is a variation of the default generation. It can also be customized if it is a customized world from before 1.13. In this case the world becomes default if opened using 1.13 or newer.
      • [NBT Compound / JSON Object] generatorOptions: Used in 1.15 and below. Used in buffet, superflat, and old customized worlds. Format below.
      • [Int] generatorVersion: Used in 1.15 and below. The version of the level generator. The effects of changing this are unknown, but values other than 0 have been observed.
      • [Boolean] hardcore: 1 or 0 (true/false) - If true, the player respawns in Spectator on death in singleplayer. Affects all three game modes.
      • [Boolean] initialized: 1 or 0 (true/false) - Normally true after a world has been initialized properly after creation. If the initial simulation was canceled somehow, this can be false and the world is re-initialized on next load.
      • [Long] LastPlayed: The Unix time in milliseconds when the level was last loaded.
      • [String] LevelName: The name of the level.
      • [Boolean] MapFeatures: 1 or 0 (true/false) - true if the map generator should place structures such as villages, strongholds, and mineshafts. Defaults to 1. Always 1 if the world type is Customized.
      • [NBT Compound / JSON Object] Player: The state of the singleplayer player. This overrides the <player>.dat file with the same name as the singleplayer player. This is saved by servers only if it already exists, otherwise it is not saved for server worlds. See Player.dat format.
      • [Boolean] raining: 1 or 0 (true/false) - true if the level is currently experiencing rain, snow, and cloud cover.
      • [Int] rainTime: The number of ticks before "raining" is toggled and this value gets set to another random value.
      • [Long] RandomSeed: The random level seed used to generate consistent terrain.
      • [Long] SizeOnDisk: The estimated size in bytes of the level. Currently not modified or used by Minecraft, but was previously.
      • [Int] SpawnX: The X coordinate of the world spawn.
      • [Int] SpawnY: The Y coordinate of the world spawn.
      • [Int] SpawnZ: The Z coordinate of the world spawn.
      • [Boolean] thundering: 1 or 0 (true/false) - If "raining" is true : true if the rain/snow/cloud cover is a lightning storm and dark enough for mobs to spawn under the sky. If "raining" is false, this has no effect.
      • [Int] thunderTime: The number of ticks before "thundering" is toggled and this value gets set to another random value.
      • [Long] Time: The number of ticks since the start of the level.
      • [Int] version: The NBT version of the level, with 1.2.1 being 19133 Anvil file format.
      • [NBT Compound / JSON Object] Version: Information about the Minecraft version the world was saved in.
        • [Int] Id: An integer displaying the data version.
        • [String] Name: The version name as a string, e.g. "15w32b".
        • [String] Series: Developing series. In 1.18 experimental snapshots, it was set to "ccpreview". In others, set to "main".
        • [Boolean] Snapshot: 1 or 0 (true/false) – Whether the version is a snapshot or not.
      • [Int Array] WanderingTraderId: The UUID of the current wandering trader in the world saved as four ints.
      • [Int] WanderingTraderSpawnChance: The current chance of the wandering trader spawning next attempt; this value is the percentage and is divided by 10 when loaded by the game, for example a value of 50 means 5.0% chance.
      • [Int] WanderingTraderSpawnDelay: The amount of ticks until another wandering trader is attempted to spawn.
      • [Boolean] WasModded: 1 or 0 (true/false) - true if the world was opened in a modified version.

generatorOptions tag format

The [NBT Compound / JSON Object] generatorOptions tag format varies depending on the generator name. It affects only the Overworld dimension. This applies to 1.15 and below.

This is the format for the Buffet world type:

  • [NBT Compound / JSON Object] generatorOptions:
    • [NBT Compound / JSON Object] biome_source:
      • [NBT Compound / JSON Object] options: Ignored if the biome source ID is minecraft:vanilla_layered.
        • [NBT List / JSON Array] biomes:
          • [String]: A biome ID. If this or the biome source ID is omitted or invalid, the code assumes minecraft:ocean.
        • [Byte] size: The size of the biomes. Only used when the biome source ID is minecraft:checkerboard. The biome squares have sides of 2<size> (which can be < 1) chunks. If no value is entered, the code assumes 2.
      • [String] type: An applicable biome source ID. It determines how the biomes are distributed. Cannot be selected in-game and defaults to minecraft:fixed for unmodified worlds.
    • [NBT Compound / JSON Object] chunk_generator:
      • [NBT Compound / JSON Object] options:
        • [String] default_block: A block ID, by default minecraft:stone.
        • [String] default_fluid: A fluid ID, by default minecraft:water.
      • [String] type: An applicable chunk generator ID. It determines the overall structure of the dimension. If this is omitted or invalid, the code assumes minecraft:surface.

This is the format for the Superflat world type:

  • [NBT Compound / JSON Object] generatorOptions:
    • [NBT Compound / JSON Object] structures:
      • [NBT Compound / JSON Object] <structure name>: An empty compound named as the structure, for example decoration. If parameters are set, for example village(distance=9 size=1), then the compound contains this information.
        • [String] <parameter name>: The parameter value is a number represented by a string.
    • [NBT List / JSON Array] layers:
      • [NBT Compound / JSON Object]: A layer.
        • [String] block: The block ID.
        • [Int] height: The height of the layer, used in worlds created before 1.13-pre5.
        • [Byte] height: The height of the layer, used in worlds created since 1.13-pre5, if it's < 128 blocks.
        • [Short] height: The height of the layer, used in worlds created since 1.13-pre5, if it's >= 128 blocks.
    • [String] biome: The biome ID.
    • [String] flat_world_options: The unescaped "generator-settings" string. Created only if the world was generated through a server. Until snapshot 20w11a, it is not parsed by the game due to MC-134900, thus the above compounds won't be created, making "generator-settings" ineffective.

This is the format for the Old Customized world type that existed before 18w06a:

  • [String] generatorOptions: Controls options for the world generator. Used only if the world type is Superflat or Customized. The format for Superflat is a comma separated list of block IDs from the bottom of the map up, and each block ID may optionally be preceded by the number of layers and an "*" ("x" before 1.8). Damage values are not supported.[1] See detailed format for Superflat world type: before 1.8 and in 1.8-1.12. Refer also to Superflat#History that shows how the format has been changing over time. The format for Customized world type is an extremely long String which consists of name:value pairs resembling JSON (as shown in Old_Customized#Presets).

session.lock format

This file contains a single character U+2603 ☃ SNOWMAN encoded (E2 98 83) in UTF8.

The process goes something like this:

  1. Program opens session.lock.
  2. Program writes a single character ☃ (\u2603) to session.lock.
  3. Program tries to acquire a lock on a session.lock.
  4. If the lock on a session.lock fails, program aborts and gives up its lock on the level.

Minecraft can sometimes try to hold the lock on a level even after the player has started playing a different level, and this can cause strange behavior. It is recommended to ensure that Minecraft is closed before trying to acquire a lock on a level.

Before 1.16, the lock contained a big endian 64-bit integer timestamp of when the level was last accessed since the epoch. The program, instead of writing a snowman and acquiring a lock, would monitor the file for changes, and would abort if changed.

poi format

Files in the poi folder use similar structure to region Anvil files (hence the mca extension), but the NBT content is different.

  • [NBT Compound / JSON Object] The root tag.
    • [NBT Compound / JSON Object] Data: This tag contains all the level data.
      • [NBT Compound / JSON Object] Sections: Keys are stringified chunk section's Y coordinate (can be negative, a section at Y=2 starts at block Y=32).
        • [NBT Compound / JSON Object] <number>:
          • [Boolean] Valid: True (1) when created by the game, however, if the decoding of POI NBT (from the region file) data fails, and the game then save the region file again, it might save false (0). This key is internally set to true when the POI section is refreshed, and a refresh always happens when the chunk section (with terrain data) at the same coordinates is decoded. To sum up, it is very unlikely to get false.
          • [NBT List / JSON Array] Records: May be empty.
            • [NBT Compound / JSON Object]: Single record.
              • [Int Array] pos: 3-element array encoding X, Y and Z.
              • [Int] free_tickets: Indicates how many "tickets" are available for villagers to claim. A value of zero indicates that this poi is not available for any villager to claim. Internally Minecraft specifies a max tickets for each poi type. This is the maximum number of villagers which can "take a ticket" (aka be using that poi type at the same time; aka max number of villagers which can claim that poi and store it in their "brain"). As of 1.17 all villager eligible poi type's have a ticket limit of one (1), with the single exception being minecraft:meeting, (block minecraft:bell) which has a limit of 32. Poi entries which are not for villager interaction such as beehives, nether portals, lighting rods, etc., have a max ticket count of zero (0) and therefore always have a free_tickets of zero as well.
              • [String] type: Type of the point, for example: minecraft:home, minecraft:meeting, minecraft:butcher, minecraft:armorer, etc.
    • [Int] DataVersion: An integer displaying the data version.

History

Java Edition
1.1419w11aThe poi folder was added to world saves and village data is moved to it.
1.1620w14aTimestamps are no longer written to the session.lock file.
1.16pre1A single character ☃(E2 98 83) is now written to the session.lock file.

See also

Navigation