Editing
Java Edition Classic level format
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{outdated}} {{exclusive|java}} The '''Classic level format''' refers to the order information is saved in level files from [[Minecraft]] [[Classic]] and [[Pre-Classic]]. There were three separate formats used during these versions. In all formats, they were compressed with [[Wikipedia:Gzip|gzip]]. The first format lasted from [[Java Edition pre-Classic rd-132211|rd-132211]] to [[Java Edition Classic 0.0.12a 03|Classic 0.0.12a_03]] and only contained the blocks in the world. The second format lasted from [[Java Edition Classic 0.0.13a|Classic 0.0.13a]] to [[Java Edition Classic 0.0.13a 03|Classic 0.0.13a_03]] and contained a short header followed by the blocks. The third format lasted from [[Java Edition Classic 0.0.14a|Classic 0.0.14a]] to [[Java Edition Classic 0.30|Classic 0.30]] and contained a short header followed by serialized Java objects with lots of different data. Single-player levels had the extension ".dat" or ".mine". Levels used by the Classic servers were named "server_level.dat". The Classic level format can be read by the <span class="plainlinks>[https://github.com/bluecrab2/ClassicExplorer/releases/ ClassicExplorer program]</span>. For the last format that used Java's Serializable interface, the easiest way to work with it was through the Classic server itself, <span class="plainlinks">[http://minecraft.net/servers.jsp minecraft-server.jar]</span>. [[Development resources/Example Minecraft Classic Level Editing Class|Sample code]] was provided to show how to build an editor on top of minecraft-server.jar. == File Format == ===First Format=== {| class="wikitable sortable" ! Data ! Length (Bytes) ! Description |- | Block Array | 4194304 (2^22) | An array of blocks in the world in the order: layers of the world from y = 0 to build height, in each layer have strips from z = 0 to the edge of the world, in each strip have blocks from x = 0 to the edge of the world. Each byte represents a single block using [[Java Edition data values/Classic|their ID]]. |} ===Second Format=== {| class="wikitable sortable" ! Data ! Length (Bytes) ! Description |- | Magic Number | 4 | A number used to identify the file. Always will be <code>27 1B B7 88</code>. |- | Version | 1 | A version identifier byte <code>01</code>. |- | World Name | Variable | First two bytes will be a short for the length of the string then that length bytes will be ASCII characters for the string. This string will always be either "A Nice World" or "--" depending on the start version. |- | Creator Player Name | Variable | First two bytes will be a short for the length of the string then that length bytes will be ASCII characters for the string. In Classic 0.0.13a-dev this will always be "noname" but Classic 0.0.13a_03 will be the actual user's name. |- | Time Created | 8 | A long value for the time the level was created in the Unix epoch. |- | Width | 2 | The width of the world (x direction). |- | Height | 2 | The height of the world (z direction). |- | Depth | 2 | The depth of the world (y direction). |- | Block Array | 4194304 (2^22) | An array of blocks in the world in the following order: layers of the world from y = 0 to build height, in each layer have strips from z = 0 to the edge of the world, in each strip have blocks from x = 0 to the edge of the world. Each byte represents a single block using [[Java Edition data values/Classic|their ID]]. |} ===Third Format=== {| border="1" class="wikitable" data-description="File format" ! 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 [http://java.sun.com/developer/technicalArticles/Programming/serialization/ manual], however, the easiest way to edit the file is to use the [[Development resources/Example Minecraft Classic Level Editing Class|classes]] provided here with the official <span class="plainlinks">[http://minecraft.net/servers.jsp minecraft-server.jar file]</span>. |} ==Accessing the array of bytes== The most interesting part of a level was the block array. Each byte in this array defined a [[Java Edition data values/Classic|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 <samp>minecraft-server.jar</samp> 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. The 256x256x64 bytes (default dimensions) labeled blocks in each format were where the byte array was stored. The formula <code>65536 * y + 256 * z + x = Byte #</code> will convert Minecraft coordinates to the byte number in the array. {{Java Edition}} [[Category:Server]] [[de:Spielstand-Speicherung/Classic Level Format]] [[fr:Format de carte Classique]] [[nl:Classic level formaat]] [[pt:Formato de nível da Edição Java Classic]] [[ru:Классический формат карт]] [[zh:Classic世界格式]]
Summary:
Please note that all contributions to Kiiw may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Kiiw:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Exclusive
(
edit
)
Template:Java Edition
(
edit
)
Template:Outdated
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information