Skip to content

MapBlock dictionary

fancyfinn9 edited this page Dec 27, 2025 · 7 revisions

Each MapBlock has a dictionary in self.data with the parsed data of the MapBlock.

The data is parsed from the raw binary data of the MapBlock. Please consult Luanti's MapBlock Serialization Format for the binary data's documentation.

Some unnecessary values that exist in the raw binary data but are obsolete in this format (such as name lengths) or are potentially dangerous to expose (such as fixed version numbers) have been removed.

In general, you should not touch anything if you are not aware of the implications that modifying it may cause. If you are unsure, use mtanvil's helper functions or read the page linked above.

General values

  • was_compressed (bool): Indicates whether the binary data was compressed with zstd or not.

  • version (int): MapBlock format version number. Latest is 29.

  • flags (dict): Flags for the MapBlock.

    • is_underground (bool): If true, Luanti will not calculate sunlight from above for this MapBlock.
    • day_night_differs (bool): Whether the lighting of the block is different on day and night.
    • lighting_expired (bool): Not used in format version 27 and above, see lighting_complete instead. If true, lighting is invalid and should be updated.
    • generated (bool): Whether the MapBlock has been generated yet. If false, the MapBlock is most likely filled with CONTENT_IGNORE and parts of structures (eg trees) from neighbouring MapBlocks.
  • lighting_complete (dict): Indicates if the light is correct at the sides of a map block. If any is false, Luanti will automatically recompute light when both this block and its required neighbor are loaded. Nothing flags should always be set.

    • nothing1 (bool)
    • nothing2 (bool)
    • nothing3 (bool)
    • nothing4 (bool)
    • night (dict): Lighting at night
      • X- (bool)
      • Y- (bool)
      • Z- (bool)
      • Z+ (bool)
      • Y+ (bool)
      • X+ (bool)
    • day (dict): Lighting during the day
      • Same as night
  • timestamp (int): Timestamp when last saved, as seconds from starting the game. 4294967295 is an invalid/unknown timestamp, use when nothing should be done with the time difference.

Name ID Mapping

Note: mtanvil handles mappings automatically so you should not need to touch this

  • name_id_mappings (list): List of name ID mappings.
    • foreach mapping:
      • id (int): The ID in the node data that is used to represent this node.
      • name (str): The node name (eg "default:goldblock").

Node Data

  • nodes (list): List of all the Nodes in the MapBlock

Legacy data (will probably be removed in a future release)

  • content_width (int): Number of bytes in the content (param0) fields of nodes. Always 1 before format version 24, always 2 since.

  • params_width (int): Number of bytes used for parameters (param1 and param2) per node. Always 2.

  • node_data (list): List of all nodes and their params. The location of a node in the list is (z*16*16 + y*16 + x).

    • foreach node:
      • param0 (int): The mapping ID of the node.
      • param1 (int)
      • param2 (int)

Node Metadata

  • node_metadata_version (int): Always 1 before format version 28, always 2 since. (If this is 0 then the following node metadata values are not included. mtanvil will still return an empty list.)

  • node_metadata (list):

    • position (int): Position of the relevant node in node_data.
    • vars (list): List of all vars in the node metadata.
      • foreach var:
        • key (str)
        • value (str)
        • is_private (bool)
    • serialized_inventory: NOT IMPLEMENTED YET DUE TO THE LACK OF DOCUMENTATION

Static Objects

  • static_object_version (int): Always 0

  • static_objects (list): List of static objects

    • foreach static_object:
      • type (int): Object type ID
      • pos_x (int)
      • pos_y (int)
      • pos_z (int)
      • data (bytes): A separate StaticObject class will be created soon to better support this

Node Timers

  • length_of_single_timer (int): Length of the data of a single timer. Always 10
  • timers (list):
    • foreach timer:
      • position (int): Position of the relevant node in node_data
      • timeout (int)
      • elapsed (int)

Clone this wiki locally