Minecraft Wiki
Advertisement
This page describes content that exists only in outdated versions of Minecraft. 
This feature used to be in the game but has since been removed.
Information icon
This feature is exclusive to Java Edition. 

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

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

Position Size (bytes) Name Description
0 4 Magic ID A magic ID is a constant number used to identify the Minecraft file format. The current value is 0x271bb788.
4 1 Version Number The version number represents the current format used to save the level. The current value is 2.
5 Variable Serialized Java com.mojang.minecraft.level.Level Class More information about the serialization format used by Java is available in the manual, however, the easiest way to edit the file is to use the classes provided here with the official minecraft-server.jar file.

Accessing the array of bytes

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 Development resources/Example Minecraft Classic Level Editing 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 in the order x, y, z) would allow the player to change the spawn location.

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

Advertisement