User:N3X15/INfdev File Format


 * This information pertains to the infdev development version of the game, which is only available if you have preordered the game.
 * NOTE: This information will become out of date when Notch releases the new optimized save system with more optimized chunk sizes and reorganized entity data.

Minecraft infdev introduced a new data storage challenge while under development: Terrain generated in infdev has the potential to be several terabytes in size when stored in memory, due to the sheer size of the map (several times the surface area of the Earth). Therefore, to reduce file size and memory usage, Notch decided to split the terrain into 16 x 16 x 128 chunks and store them on disk when not visible. In addition, terrain is only generated when it is within the drawing distance of the player's camera, significantly reducing save size, since most players will only be able to search a tiny fraction of the map in a reasonable time frame.

index.dat Format
index.dat is an NBT file that stores environmental data (time of day, for example) and player health, inventory, velocity, and position within the map. Most importantly, it stores the Random Seed that the terrain generator uses to seamlessly generate more terrain on the fly.

NBT Structure
The structure of the file is as follows:


 * : Holds the map information.
 * : Stores the current "time of day" within the map. 0 appears to be sunrise.
 * : Probably stores the Unix time stamp when the player saved the game.
 * : Player entity information.
 * : 3 TAG_Doubles describing the current X,Y,Z position of the player entity.
 * : Unknown
 * : Current velocity of the player entity at the time of the save, stored as 3 TAG_Doubles (X,Y,Z). (Note: Falling into the void appears to set this to ridiculously high speeds.  0,0,0 is no motion.)
 * : Unknown
 * Has something to do with fire and how much health is taken each second. -20 appears to be the baseline, but can dip as low as -1000 and as high as 1000.
 * : Amount of health the player currently possesses. 0 is dead, 20 is full health.
 * Unknown
 * How much oxygen the player has while underwater. 200 is the unmodified maximum, 0 indicates the player is out of breath.
 * : Up to 36 (9 columns, 4 rows including "on-hand" items) TAG_Compounds containing 4 items. 0-8 are on-hand slots (slots shown on-screen during normal gameplay), the rest are backpack slots, accessible through the inventory menu.  Order of these items may be important.
 * Item or Block ID (see Blocks, items and data values).
 * The amount of wear each tool has suffered. 0 is undamaged, maximum may be different for each tool. Non-tool items (blocks, for example) have 0 damage.
 * Number of items stacked in this inventory slot. Curiously, tools can be stacked as well.  Range is 1-255. (Counts over a certain number make the white stack count number in the inventory menu disappear, picking up more items results in the count being reset).
 * Number of range 0-35 indicating the slot number. 0-8 are on-hand items, 9-35 are backpack items.
 * 2 TAG_Floats depicting the player rotation at time of game save. Axes and type (degrees/radians) are unknown at this time.
 * Current score of the player, doesn't appear to be implemented yet. Baseline is 0.
 * Unknown
 * X coordinate of the player's spawn position. Default is 0.
 * Y coordinate of the player's spawn position. Default is 64.
 * Z coordinate of the player's spawn position. Default is 0.
 * Size of the entire saves, possibly in bytes.
 * Random number providing the Random Seed for infdev's level generator.
 * Random number providing the Random Seed for infdev's level generator.

*/*/c.*.*.dat Format
These files are the 16x16x128 chunks themselves. The file names are the Base36 chunk coordinates.

Chunks store the blocks within a 16x16x128 area, as well as lighting, a heightmap, and other useful tidbits.

NBT Structure

 * Stores data about the chunk.
 * 16384 bytes of data pertaining to blocks. Format unclear.
 * List of entities (mobs, falling sand/gravel/TNT(?)) in the area. Format similar to that of the player.
 * Unknown.
 * X coordinate of the chunk. Should match the file name.
 * Z coordinate of the chunk. Should match the file name.
 * Appears to store tile entities (chests, Mob spawners), but the format is unclear.
 * : A tile entity (following is minimum Tile Entity info:)
 * : Tile entity ID (MobSpawner, Chest)
 * / / : Local coordinates of the TileEntity.
 * 1 or 0 (true/false) value seeming to indicate whether the player has built or edited the terrain in this area. Unclear.
 * 16384 bytes having to do with lighting, but format is unclear.
 * 256 bytes of heightmap data. 16x16, bytes are height values.
 * 16384 bytes, format unclear.
 * 32768 blocks in byte form. See for details

Block Format
Blocks in each chunk are accessed via the following method:

// From Cartographer Level.cpp, license appears to be public domain // Edited for clarity unsigned char BlockID = Blocks[x * ChunkSizeY + y * ChunkSizeY * ChunkSizeX + z];

Mind that, in Minecraft's saves, X is east-west, Y is altitude (0 being underground), and Z is north-south.