Classic level format

From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Java Edition.
Rose (2D).png
This page describes content that is no longer in the game.
These features only exist in outdated versions of Minecraft.

The Classic level format was used by all varieties of Minecraft Classic. It was compressed with gzip and contained a short header followed by serialized Java objects. Single-player levels had the extension ".mine". Levels used by the Classic Creative server were named "server_level.dat". The file could be backed up to save content, which helped to protect constructions against griefers or to use the file for map editing.

Because the format of this level depended on the way Java serializes objects, the easiest way to work with it was through the Classic server itself, minecraft-server.jar. Sample code was provided to show how to build an editor on top of minecraft-server.jar.

File Format[edit]

When uncompressed, the format of the file was as follows:

Position Size (bytes) Name Description

Accessing the array of bytes[edit]

The most interesting part of a level was the block array. Each byte in this array defined a block type at a corresponding location in the world. One generally had two options for accessing the byte array of blocks:

The player could deserialize the compressed .dat file directly back into an instance of a Level object inside of Java, thus having access to the instance of the Level object in exactly the same way the Minecraft Server does. This would allow the player to set the blocks, dimensions, spawn point and other aspects of the map directly by calling the methods on the instantiated Level object. Manual decompression is not needed before loading, because Java can compress and decompress gzipped files on the fly. To load the datafile back into an instance of the Level class, the player would need the class definition for the Level class. This was included with the minecraft-server.jar file. An example of this could be seen in the creation and saving class.

Others have read and modified the map's data by simply accessing the raw byte array in the datafile file. To do this, the player would decompress it, make changes to the bytes where the byte array is stored, and then compress it again. Since the player was editing it raw, they needed to keep the first 344 (14E in HEX) bytes intact. The next 256x256x64 bytes were where the byte array was stored. Additionally, it was also possible to alter the spawn location coordinates this way if the player knew where to look: there were integer values starting at byte 284 and thus overwriting the next 12 bytes (3 integers) would allow the player to change the spawn location.

(Disclaimer: This is liable to change as Java changes)