Anvil file format

The Anvil file format was officially introduced in Minecraft 1.2. It brings a list of changes and improvements over from the previous file format, Region. It was implemented as of snapshot 12w07a.

Changes from MCRegion
The only changes from MCRegion to Anvil were in the Chunk format - the Region file format is still used, but labeled as Anvil. The Anvil format introduced these changes to the Chunk format:
 * Maximum build height has been increased to 256 (was 128).
 * Empty sections of the world are not loaded into memory or saved to disk.
 * The maximum Block ID has been increased to 4096 (was 256) by adding a 4 bit data layer (similar to how meta data is stored). The rest of Minecraft's code is not currently prepared to take advantage of this, however.
 * Block ordering has been changed from XZY to YZX in order to improve compression.
 * Packets for sending chunks have been optimized (a full 256-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; this is very useful for map makers.

Further information
Minecraft Snapshot 12w07a/b and 1.2 will automatically convert worlds to the new format, but a copy of the world files will be created in the previous formats for compatibility with older game versions. The world generator has not been changed, so there will be an additional 128 blocks of air above the usual terrain, making 192 blocks from sea level to the height limit.

Additional information may be found on the Chunk format page.
 * The 16x128x16 "Blocks", "Data", "SkyLight" and "BlockLight" tags were moved and repurposed. (see below)
 * A "Sections" List tag containing Compound tags has been added with up to 16 Compound tags.
 * Each section has 16x16x16 "Blocks", "Data", "SkyLight" and "BlockLight" tags.
 * Each section has a "Y" Byte 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 an optional "Add" tag, which is a DataLayer byte array just like "Data". The "Add" 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 = (add << 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, as will any -1 values in the array. The converter source provided for developers doesn’t include any biome sources, however.
 * Note that the old format is XZY ((x * 16 + z) * 16 + y) and the new format is YZX ((y * 16 + z) * 16 + x) (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").
 * A new NBT tag type called IntArray was added to the NBT Format (With ID 11) and is used by the "Heightmap" tag.

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

Reducing the world's size after conversion (on SMP server)
The world data in Anvil format has an .mca suffix, while the data in McRegion format ends on .mcr To maintain about the size of backups, the .mcr files may be deleted (after backing them up!). This can be achieved by e.g. DEL /F /S /Q \*.mcr find. -name "*.mcr" -delete
 * Windows command prompt
 * Open Windows command prompt (Win-r, cmd, Enter)
 * execute this command (without the <> characters):
 * Windows explorer
 * Open Windows Explorer (Win-e)
 * browse to the folder containing the world data
 * select it
 * search this folder (F3)
 * search for *.mcr
 * mark all search results (ctrl-a)
 * hit delete
 * Linux shell
 * cd into the folder that contains the world data
 * run this command