Module get_catalog
Catalog functions
Class Catalog
Catalog:get_size () | Get the overall size of the catalog |
Catalog:has_mapblock (catalog_mapblock_pos) | Check for the existence of a mapblock in the catalog |
Catalog:deserialize (catalog_mapblock_pos, world_mapblock_pos, options) | Deserialize a single mapblock from the catalog |
Catalog:prepare (catalog_mapblock_pos, options) | Prepare a mapblock with options for faster access |
Catalog.deserialize_all_options | Deserialize options |
Catalog:deserialize_all (target_mapblock_pos, options) | Deserialize all mapblocks in the catalog to the world |
mapblock_lib.get_catalog (filename) | create a new catalog wrapper for the given filename |
Class Catalog
Catalog object
- Catalog:get_size ()
-
Get the overall size of the catalog
Returns:
-
util.mapblock_pos the size in mapblocks
- Catalog:has_mapblock (catalog_mapblock_pos)
-
Check for the existence of a mapblock in the catalog
Parameters:
- catalog_mapblock_pos util.mapblock_pos the mapblock position in the catalog
Returns:
-
the zip-manifest entry of the meta-file or nil if not found
- Catalog:deserialize (catalog_mapblock_pos, world_mapblock_pos, options)
-
Deserialize a single mapblock from the catalog
Parameters:
- catalog_mapblock_pos util.mapblock_pos the mapblock position in the catalog
- world_mapblock_pos util.mapblock_pos the mapblock position in the world
- options deserialize_mapblock.deserialize_options mapblock deserialization options
Returns:
- success true on success
- error in case of an error
See also:
- Catalog:prepare (catalog_mapblock_pos, options)
-
Prepare a mapblock with options for faster access
Parameters:
- catalog_mapblock_pos util.mapblock_pos the mapblock position in the catalog
- options deserialize_mapblock.deserialize_options mapblock deserialization options
Returns:
- deserFn a function that accepts a mapblock position util.mapblock_pos to write the mapblock to the map
- error in case of an error
- Catalog.deserialize_all_options
-
Deserialize options
Fields:
- callback function to call when the blocks are deserialized
- progress_callback function to call when the progress is update
- error_callback function to call on errors
- mapblock_options function that returns the deserialization options when called with a mapblock_pos as param
- delay number for async mode: delay between deserialization-calls
- rotate_y number the y rotation, can be 0,90,180 or 270 degrees
- Catalog:deserialize_all (target_mapblock_pos, options)
-
Deserialize all mapblocks in the catalog to the world
Parameters:
- target_mapblock_pos util.mapblock_pos the first mapblock position
- options [opt] deserialize_all_options deserialization options
See also:
- mapblock_lib.get_catalog (filename)
-
create a new catalog wrapper for the given filename
Parameters:
- filename the file to read from
Returns:
-
Catalog the catalog object