Development resources

Map File Format
Blocks, items and data values are common to all map types.

Map Formats

 * .dat Map Format
 * Map Format (NBT) 1 2
 * Alpha (InfDev) Level Format

Map Editing

 * Map Editing (general)
 * Map Editing (hex)

Libraries

 * Java Classes to Deserialize Maps
 * Java Class to read and write NBT structures

Heartbeats
To be able to connect to a server in Minecraft Classic, a server must broadcast to minecraft.net a so-called "heartbeat" every few minutes.

A "heartbeat" takes the form of an HTTP request to http://www.minecraft.net/heartbeat.jsp. After sending a heartbeat, the URL for the server is returned.

It can be a GET or POST request. A table of the required parameters is below:

Simple Method
The simplest way to send a heartbeat is to open a TCP socket to port 80 on www.minecraft.net, and send the following (with the values changed, obviously):

GET /heartbeat.jsp?port=25565&max=32&name=My%20Server&public=True&version=7&salt=wo6kVAHjxoJcInKx&users=0

Make sure any strings, like name, are escaped.

In response you'll receive a URL to the server. Else you'll get a nice HTML error message.

(No headers are returned if you use the HTTP/0.9 request format as shown above, making this simple method even simpler.)

Packet Protocol
The data here regards Minecraft Classic. For info on the protocol for Minecraft Alpha, see the TkTech wiki page as well as the authentication protocol here.

Every packet starts with a byte representing the Packet ID.

Fixed Point
Player position is represented via X, Y, and Z fixed-point coordinates. The fractional portion is 6 bits, so dividing the short integers received in position update packets by 32, you will have floating point coordinates for the player. This position corresponds to the center of the client viewport.

Standing On Things
The bottom of the player's feet is located 1.59375 (fixed-point: 51) units below the center of the viewport, so to position the player on top of a particular block you could send a teleport (0x08) packet specifying a Y value based on the block position as: (Y x 32 + 51)

Orientation
A heading value of 0 means the player is facing in the Z=0 (negative Z) direction. This value increases in a clockwise direction as seen from above. If we call the negative Z direction "North", then a heading of 64 means "East", 128 means "South", and 192 means "West".

A pitch value of 0 means level and this value increases in a downward direction. 64 is down, and 192 is up. Values of 65 to 191 should never occur because the player cannot look further up or down than the 64 &rarr; 0, 255 &rarr; 192 range.

Color Codes
Messages sent from the server to the client can contain color codes, which allow coloring of text for various purposes. An ampersand followed by a hex digit in the message tells the client to switch colors while displaying text. Colour coding at the start of the message will only work if the player ID byte is less than 127. If it's 127 or higher, the game automatically adds &e before the message, making it yellow. However, colour codes after the first character still work. If you use an ID below 127, it doesn't add a colour code, so the ones you use will work.



Mobs

 * See also: Mobs

In multiplayer creative mode, all mobs are treated the same by the client. To create non-player mobs, simply send updates for them as you would a normal player. The client finds a mob's skin by its name, downloading from http://minecraft.net/skin/name.png and defaulting to the generic mob if it doesn't exist. To give your monsters a special skin, you would need to register and pay for an account with the monster's name.

You can also send fake names for actual players in order to force them to have a certain skin.