mapformat.txt 2.5 KB

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