Anvil file format

Minecraft 1.2 will introduce a new world format. Anvil, as it is called, brings a list of changes and improvements over the previous file format, Region. It is currently implemented in Snapshots 12w07a and 12w07b.

Changes from Region

 * Maximum build height has been increased to 256 (was 128).
 * Empty sections of the world are not loaded into memory.
 * Block ids have been increased to 4096 (was 256) by adding a 4 bit data layer (similar to how meta data is stored).
 * Block ordering have been changed from x/z/y to y/z/x in order to improve compression.
 * Packets for sending chunks have been updated (a full 128-high chunk is smaller than the old format, and a chunk with lots of empty space is much smaller).
 * Biomes are saved per x/z column, which means they can be altered by tools.

Further information
Minecraft Snapshot 12w07a/b and 1.2 will automatically convert worlds to the new format. World files in previous formats will remain untouched, allowing the player to use them in older game versions. The world generator has not been changed, so there will be an additional 128 blocks of air above the usual terrain. Which means 192 blocks from sea level to the height limit, as demonstrated in this video.


 * The 16x128x16 “Blocks”, “Data”, “SkyLight” and “BlockLight” tags are removed.
 * A “Sections” tag has been added with up to 16 compound tags.
 * Each section has 16x16x16 “Blocks”, “Data”, “SkyLight” and “BlockLight” tags.
 * Each section has a “Y” integer tag saying which section it is (note that some Y positions can be skipped). 0 is at the bottom of the world and 15 is the topmost section.
 * Each section also has a “AddBlocks” tag, which is a DataLayer byte array just like “Data”. The “AddBlocks” tag is not included in the converter since the old format never had block ids above 255. This extra tag is created whenever a block requires it, so the getTile method needs to check if the array exists and then combine it with the default block data. In other words, blockId = (addBlock << 8) + baseId.
 * Each chunk has a 16×16 byte array with biome ids called “Biomes”. If this array is missing it will be filled when the game starts. The converter source provided for developers doesn’t include any biome sources, however.
 * Note that the old format is XZY and the new format is YZX (see the difference between DataLayer and OldDataLayer).
 * The new format uses the extension “.mca” instead of “.mcr” (the old format is kept for safety, with the level.dat backed up as “level.dat_mcr”).

Standalone Converter and Source Code
The converter and source code were released individually for developers to examine and prepare.