Java Edition level format

In Minecraft 1.0, 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.

Level folders will always contain the items in bold, and will sometimes contain the items in italics.

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. It is an NBT file with this structure:
 * TAG_Compound(""): The root tag.
 * TAG_Compound("Data"): This tag contains all the level data.
 * TAG_Int("version"): The NBT version of the level, 19133.
 * TAG_Byte("initialized"): 1 or 0 (true/false) - unknown, only observed as true.
 * TAG_String("LevelName"): The name of the level.
 * TAG_String("generatorName"): The name of the generator; "default", "flat", or "largeBiomes". Not case sensitive, but always written in the case here.
 * TAG_Int("generatorVersion"): The version of the level generator. The effects of changing this are unknown, but values other than 0 have been observed.
 * TAG_Long("RandomSeed"): The random level seed used to generate consistent terrain.
 * TAG_Byte("MapFeatures"): 1 or 0 (true/false) - true if the map generator should place structures such as villages, strongholds, and mineshafts.
 * TAG_Long("LastPlayed"): The Unix time when the level was last loaded.
 * TAG_Long("SizeOnDisk"): The estimated size in bytes of the level. Currently not modified or used by Minecraft, but was previously.
 * TAG_Byte("allowCommands"): 1 or 0 (true/false) - true if cheats are enabled.
 * TAG_Byte("hardcore"): 1 or 0 (true/false) - true if the player must delete their world on death in singleplayer. Affects all three game modes.
 * TAG_Int("GameType"): The default game mode for the singleplayer player when they spawn or respawn. 0 is Survival Mode, 1 is Creative Mode, 2 is Adventure Mode. Note: the singleplayer player does not use this field to save which game mode they are currently in.
 * TAG_Long("Time"): The number of ticks since the start of the level; affects 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.
 * TAG_Int("SpawnX"): The X coordinate of the world spawn.
 * TAG_Int("SpawnY"): The Y coordinate of the world spawn.
 * TAG_Int("SpawnZ"): The Z coordinate of the world spawn.
 * TAG_Byte("raining"): 1 or 0 (true/false) - true if the level is currently experiencing rain, snow, and cloud cover.
 * TAG_Int("rainTime"): The number of ticks before "raining" is toggled and this value gets set to another random value.
 * TAG_Byte("thundering"): 1 or 0 (true/false) - true if the rain/snow/cloud cover is a lightning storm and dark enough for mobs to spawn under the sky.
 * TAG_Int("thunderTime"): The number of ticks before "thundering" is toggled and this value gets set to another random value.
 * TAG_Compound("Player"): The state of the Singleplayer player. This overrides the .dat file with the same name as the Singleplayer player. This is only saved by Servers if it already exists, otherwise it is not saved for server worlds. See Player.dat Format.

session.lock Format
This file contains the timestamp of when the level was last accessed. The file contains a single 64-bit integer in big endian format, which is the timestamp, stored as the number of milliseconds elapsed since 1970, in UTC.

Unlike typical lock files, this file ensures that the last program to access the level is that one that has read and write access. The process goes something like this:
 * 1) Program opens session.lock
 * 2) Program writes timestamp to session.lock
 * 3) Program monitors session.lock for changes
 * 4) If the contents of session.lock change, 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.