amulet.utils.world_utils
module¶
- amulet.utils.world_utils.block_coords_to_chunk_coords(*args, sub_chunk_size=16)[source]¶
Converts the supplied block coordinates into chunk coordinates
- 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
- amulet.utils.world_utils.region_coords_to_chunk_coords(rx, rz)[source]¶
Converts the supplied region coordinates into the minimum chunk coordinates of that region
- amulet.utils.world_utils.blocks_slice_to_chunk_slice(blocks_slice, chunk_shape, chunk_coord)[source]¶
Converts the supplied blocks slice into chunk slice
- amulet.utils.world_utils.from_nibble_array(arr)[source]¶
Unpacks a flat nibble array into a full size numpy array
- amulet.utils.world_utils.to_nibble_array(arr)[source]¶
packs a full size numpy array into a nibble array.
- amulet.utils.world_utils.decode_long_array(long_array, size, bits_per_entry, dense=True, signed=False)[source]¶
Decode a long array (from BlockStates or Heightmaps)
- Parameters
long_array (
ndarray
) – Encoded long arraysize (
int
) – The expected size of the returned arraybits_per_entry (
int
) – The number of bits per entry in the encoded array.dense – If true the long arrays will be treated as a bit stream. If false they are distinct values with padding
signed (
bool
) – Should the returned array be signed.
- Return type
- Returns
Decoded array as numpy array
- amulet.utils.world_utils.encode_long_array(array, bits_per_entry=None, dense=True, min_bits_per_entry=1)[source]¶
Encode a long array (from BlockStates or Heightmaps)
- Parameters
array (
ndarray
) – A numpy array of the data to be encoded.bits_per_entry (
Optional
[int
]) – The number of bits to use to store each value. If left as None will use the smallest bits per entry.dense (
bool
) – If true the long arrays will be treated as a bit stream. If false they are distinct values with paddingmin_bits_per_entry – The mimimum value that bits_per_entry can be. If it is less than this it will be capped at this value.
- Return type
- Returns
Encoded array as numpy array