world_utils module

utils.world_utils.block_coords_to_chunk_coords(x, z)[source]

Converts the supplied block coordinates into chunk coordinates

Parameters:
  • x (int) – The x coordinate of the block
  • z (int) – The z coordinate of the block
Return type:

Tuple[int, int]

Returns:

The resulting chunk coordinates in (x, z) order

utils.world_utils.blocks_slice_to_chunk_slice(blocks_slice)[source]

Converts the supplied blocks slice into chunk slice :type blocks_slice: slice :param blocks_slice: The slice of the blocks :rtype: slice :return: The resulting chunk slice

utils.world_utils.chunk_coords_to_block_coords(x, z)[source]

Converts the supplied chunk coordinates into block coordinates

Parameters:
  • x (int) – The x coordinate of the chunk
  • z (int) – The z coordinate of the chunk
Return type:

Tuple[int, int]

Returns:

The resulting block coordinates in (x, z) order

utils.world_utils.chunk_coords_to_region_coords(cx, cz)[source]

Converts the supplied chunk coordinates into region coordinates

Parameters:
  • cx (int) – The x coordinate of the chunk
  • cz (int) – The z coordinate of the chunk
Return type:

Tuple[int, int]

Returns:

The resulting region coordinates in (x, z) order

utils.world_utils.from_nibble_array(arr)[source]

Unpacks a nibble array into a full size numpy array

Parameters:arr (ndarray) – The nibble array
Return type:ndarray
Returns:The resulting array
utils.world_utils.get_size(obj, seen=None)[source]

Recursively finds size of objects

utils.world_utils.get_smallest_dtype(arr, uint=True)[source]

Returns the smallest dtype (number) that the array can afford :type arr: ndarray :param arr: The array to check on :type uint: bool :param uint: Should the array fit in uint or not (default: True) :rtype: int :return: The number of bits all the elements can be represented with

utils.world_utils.gunzip(data)[source]

Decompresses data that is in Gzip format

utils.world_utils.region_coords_to_chunk_coords(rx, rz)[source]

Converts the supplied region coordinates into the minimum chunk coordinates of that region

Parameters:
  • rx (int) – The x coordinate of the region
  • rz (int) – The y coordinate of the region
Return type:

Tuple[int, int]

Returns:

The resulting minimum chunk coordinates of that region in (x, z) order