-
Notifications
You must be signed in to change notification settings - Fork 96
BlockDB format
The BlockDB format is very simple, it solely consists of a sequence of 16 byte blocks.
This is the first block in a file.
8 | Format identifier "CBDB_MCG"
2 | Format version, currently '1'
2 | Width of the map
2 | Height of the map (vertical)
2 | Length of the map
Note: The map dimensions in the BlockDB may not be the same as the map dimensions in the map file. (If the map has been resized to be smaller for example)
The rest of the file is a variable number of these blocks.
4 | Player ID
4 | Packed index (x + width * (z + y * length))
4 | Time delta in seconds from reference point (first second of year 2010)
1 | Old raw block ID
1 | New raw block ID
2 | Flags
This is a enumeration of bit flags that may or may not be set.
Bit 0 | Block was manually placed
Bit 1 | Block was painted
Bit 2 | Block was drawn
Bit 3 | Block was replaced
Bit 4 | Block was pasted
Bit 5 | Block was cut
Bit 6 | Block was filled
Bit 7 | Block was restored
Bit 8 | Block was undo of other
Bit 9 | Block was undo of self
Bit 10 | Block was redo of self
Bit 11 | Block was affected by FixGrass
Bit 12 | Old block is an extended block (see below)
Bit 13 | New block is an extended block (see below)
Bit 14 | Old block is a custom block id
Bit 15 | New block is a custom block id
The actual block ID can be obtained as such:
Old block: | Flags bit 12 + Flags bit 14 + Old raw block ID
New block: | Flags bit 13 + Flags bit 15 + New raw block ID
This is NOT the same ID as is received by the client, to ensure custom blocks do not conflict with existing physics block IDs, the server offsets them internally by 256.
This means custom blocks begin at server ID 256+66=332 (client ID 66), server ID 512 is client ID 256, and server ID 1023 becomes client ID 767.