Module functions
common utility functions
Functions
modgen.get_chunkpos (pos) | returns the chunk position from a node position |
modgen.get_chunk_bounds (pos) | returns the lower and upper chunk bounds for the given position |
modgen.get_chunk_bounds_from_mapblock (mapblock_pos) | returns the chunk_bounds from a mapblock-position |
modgen.get_mapblock (pos) | calculates the mapblock position from a node position |
modgen.get_filesize (filename) | Returns the filesize of the specified file |
modgen.copyfile (src, target) | copies a files from the source to the target |
modgen.write_mod_files (path) | copies the modgen-import skeleton to the specified patch |
modgen.pretty_size (bytes) | returns a formatted size as string |
modgen.update_bounds (current_pos, bounds) | updates the boundaries max- and min-positions |
modgen.get_nodeid (node_id, manifest) | returns the localized nodeid from the manifest or adds a new one |
Tables
mapblock_pos | Mapblock position |
Functions
- modgen.get_chunkpos (pos)
-
returns the chunk position from a node position
Parameters:
- pos the node-position
Returns:
-
the chunk position
- modgen.get_chunk_bounds (pos)
-
returns the lower and upper chunk bounds for the given position
Parameters:
- pos the node-position
- modgen.get_chunk_bounds_from_mapblock (mapblock_pos)
-
returns the chunk_bounds from a mapblock-position
Parameters:
- mapblock_pos mapblock_pos
Returns:
- the lower node-position
- the upper node-position
- modgen.get_mapblock (pos)
-
calculates the mapblock position from a node position
Parameters:
- pos the node-position
Returns:
-
mapblock_pos the mapblock position
- modgen.get_filesize (filename)
-
Returns the filesize of the specified file
Parameters:
- filename the filename
Returns:
-
the size in bytes or 0 if not found
- modgen.copyfile (src, target)
-
copies a files from the source to the target
Parameters:
- src the source file
- target the target file
- modgen.write_mod_files (path)
-
copies the modgen-import skeleton to the specified patch
Parameters:
- path the path to use
- modgen.pretty_size (bytes)
-
returns a formatted size as string
Parameters:
- bytes the size in bytes
Returns:
-
the formatted string
- modgen.update_bounds (current_pos, bounds)
-
updates the boundaries max- and min-positions
Parameters:
- current_pos
- bounds
- modgen.get_nodeid (node_id, manifest)
-
returns the localized nodeid from the manifest or adds a new one
Parameters:
- node_id
- manifest