world_utils module¶
-
amulet.utils.world_utils.
block_coords_to_chunk_coords
(x, z, chunk_x_size=16, chunk_z_size=16)[source]¶ Converts the supplied block coordinates into chunk coordinates
Parameters: Return type: Returns: The resulting chunk coordinates in (x, z) order
-
amulet.utils.world_utils.
blocks_slice_to_chunk_slice
(blocks_slice, chunk_shape, chunk_coord)[source]¶ Converts the supplied blocks slice into chunk slice :type blocks_slice:
slice
:param blocks_slice: The slice of the blocks :type chunk_shape:int
:param chunk_shape: The shape of the chunk in this direction :type chunk_coord:int
:param chunk_coord: The coordinate of the chunk in this direction :rtype:slice
:return: The resulting chunk slice
-
amulet.utils.world_utils.
chunk_coords_to_block_coords
(x, z, chunk_x_size=16, chunk_z_size=16)[source]¶ Converts the supplied chunk coordinates into block coordinates
Parameters: Return type: Returns: The resulting block coordinates in (x, z) order
-
amulet.utils.world_utils.
chunk_coords_to_region_coords
(cx, cz)[source]¶ Converts the supplied chunk coordinates into region coordinates
Parameters: Return type: Returns: The resulting region coordinates in (x, z) order
-
amulet.utils.world_utils.
decode_long_array
(long_array, size)[source]¶ Decode an long array (from BlockStates or Heightmaps) :type long_array:
ndarray
:param long_array: Encoded long array :type size:int
:param size: int: The expected size of the returned array :rtype:ndarray
:return: Decoded array as numpy array
-
amulet.utils.world_utils.
encode_long_array
(array)[source]¶ Encode an long array (from BlockStates or Heightmaps) :type array:
ndarray
:param array: A numpy array of the data to be encoded. :rtype:ndarray
:return: Encoded array as numpy array
-
amulet.utils.world_utils.
from_nibble_array
(arr)[source]¶ Unpacks a flat nibble array into a full size numpy array
Parameters: arr ( ndarray
) – The nibble arrayReturn type: ndarray
Returns: The resulting array
-
amulet.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