Server level.dat


Info

server_level.dat is the name of the file used by the Minecraft Classic server for loading and saving the in-game map. The file can be backed up to save content which helps to protect constructions against griefers A massively destroyed castle. Griefing is the act of irritating and angering people in video games through the use of destruction, construction, or social engineering. Popularized in Minecraft by teams, griefing has become a serious minecraft or to use the file for map editing.

General Information

The file is compressed using gzip to save space (as the files can end up being reasonably large due to everything, even air Air Type Non-Solid Block Transparency Yes Luminance No Data value dec: 0 hex: 0 bin: 0 Name air Air is the block present in otherwise empty space. Contents 1 Obtaining 1.1 Natural generation 2 Usage 3 History 4 minecraft being considered a block See the various blocks found in Minecraft. For the blocking with shields that reduces damage when performed, see Blocking. All blocks Blocks are the basic units of structure in Minecraft. Contents 1 minecraft ).

(Note: in this example, a default server_level.dat is being used, with the size of 256⃗256⃗64. Level files with bigger dimensions may differ in amount of bytes.)
The server level.dat file is where the Minecraft Server See the multiplayer software in Minecraft. For the multiplayer experience, see Multiplayer. For the official Mojang paid-for servers, see Realms. For other unofficial Minecraft server software, see custom servers. Minecraft servers allow dumps the level information for permanent storage. As this file is primarily raw level data, it can be quite large: a regular 256⃗256⃗64 sized level is 4 megabytes in size. The file is compressed using gzip, however. Most of the block values are 0 (empty space), so therefore, the size is reduced considerably by the compression, usually down to a few hundred kilobytes.

After un-gzipping the datafile (you may simply decompress the file itself using a tool which can decompress gzipped files), sequentially the datafile consists of the number 656127880 as 32 bit integer (0x27 0x1B 0xB7 0x88 in HEX), followed by the number 2 as a byte (0x02 in HEX), then followed by serialized Level Java classfile instance. The level`s block values (material type, such as stone) are stored inside of a byte array inside of this class.

The first 65536 sequential bytes of the array make up the top-most 256⃗256 “sliver" of the level, with the north-most row of bytes, from left to right, being at locations 0 ... 255, the row below that at, from left to right, locations 256 ... 511, and so on. The default maps are 64 "slivers" deep.

Videos

File Format

When uncompressed, the format of the file is 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, be that as it may, the easiest way to edit the file is to use the classes already provided with the official minecraft-server.jar file.

Accessing the array of bytes

One generally has two options for accessing the byte array of blocks:

You 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 you 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, you would need the class definition for the Level class. This is included with the minecraft-server.jar file. An example of this can be seen in the creation and saving class This article is an orphan, as few or no other articles link to it. Please introduce links to this page from related articles You can help us by linking to it or categorizing it. To .

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