Change way commands are displayed in chat window
[oweals/minetest.git] / doc / mapformat.txt
1 I'll try to quickly document the newest block format in here (might contain
2 errors). Refer to the mapgen or minetestmapper script for the directory
3 structure and file naming. There are two sector namings possible,
4 sector/XXXXZZZZ and sector/XXX/ZZZ.
5
6 There also exists files map_meta.txt and chunk_meta, that are used by the
7 generator. If they are not found or invalid, the generator will currently
8 behave quite strangely.
9
10 The MapBlock file format (sectors2/XXX/ZZZ/YYYY):
11 -------------------------------------------------
12
13 NOTE: Byte order is MSB first.
14
15 u8 version
16 - map format version number, this one is version 17
17
18 u8 flags
19 - Flag bitmasks:
20   - 0x01: is_underground: Should be set to 0 if there will be no light
21     obstructions above the block. If/when sunlight of a block is updated and
22         there is no block above it, this value is checked for determining whether
23         sunlight comes from the top.
24   - 0x02: day_night_differs: Whether the lighting of the block is different on
25     day and night. Only blocks that have this bit set are updated when day
26         transforms to night.
27   - 0x04: lighting_expired: If true, lighting is invalid and should be updated.
28     If you can't calculate lighting in your generator properly, you could try
29         setting this 1 to everything and setting the uppermost block in every
30         sector as is_underground=0. I am quite sure it doesn't work properly,
31         though.
32
33 zlib-compressed map data:
34 - content:
35   u8[4096]: content types
36   u8[4096]: param1 values
37   u8[4096]: param2 values
38
39 zlib-compressed node metadata
40 - content:
41   u16 version (=1)
42   u16 count of metadata
43   foreach count:
44     u16 position (= p.Z*MAP_BLOCKSIZE*MAP_BLOCKSIZE + p.Y*MAP_BLOCKSIZE + p.X)
45         u16 type_id
46         u16 content_size
47         u8[content_size] misc. stuff contained in the metadata
48
49 u16 mapblockobject_count
50 - always write as 0.
51 - if read != 0, just fail.
52
53 foreach mapblockobject_count:
54   - deprecated, should not be used. Length of this data can only be known by
55     properly parsing it. Just hope not to run into any of this.
56
57 u8 static object version:
58 - currently 0
59
60 u16 static_object_count
61
62 foreach static_object_count:
63   u8 type (object type-id)
64   s32 pos_x * 1000
65   s32 pos_y * 1000
66   s32 pos_z * 1000
67   u16 data_size
68   u8[data_size] data
69
70 u32 timestamp
71 - Timestamp when last saved, as seconds from starting the game.
72 - 0xffffffff = invalid/unknown timestamp, nothing will be done with the time
73                difference when loaded (recommended)
74
75 Node metadata format:
76 ---------------------
77
78 Sign metadata:
79   u16 string_len
80   u8[string_len] string
81
82 Furnace metadata:
83   TBD
84
85 Chest metadata:
86   TBD
87
88 // END
89