amulet.api.chunk.blocks module

class amulet.api.chunk.blocks.Blocks(input_array=None)[source]

Bases: UnboundedPartial3DArray

__init__(input_array=None)[source]

Construct a UnboundedPartial3DArray. This should not be used directly. You should use the relevant subclass for your use.

Parameters
  • dtype – The dtype that all arrays will be stored in.

  • default_value – The default value that all undefined arrays will be populated with if required.

  • section_shape – The shape of each section array.

  • default_section_counts – A tuple containing the default number of sections above and below the origin in the y axis. This is used to define the default bounds.

  • sections – The sections to initialise the array with.

property sub_chunks: Iterable[int][source]

An iterable of the sub-chunk indexes that exist

has_sub_chunk(cy)[source]

Check if the array for a given sub-chunk exists. :type cy: int :param cy: The section y index :rtype: bool :return: True if the array exists, False otherwise

get_sub_chunk(cy)[source]

Get the section ndarray for a given section index. :type cy: int :param cy: The section y index :rtype: ndarray :return: Numpy array for this section

add_sub_chunk(cy, sub_chunk)[source]

Add a sub-chunk. Overwrite if already exists :type cy: int :param cy: The section y index :type sub_chunk: ndarray :param sub_chunk: The Numpy array to add at this location :return:

add_section(sy, section)[source]

Add a section array at the given location.

Parameters
create_section(sy)[source]

Create a section array at the given location using the default value and dtype.

Parameters

sy (Union[int, integer]) – The section index to create.

property default_value: Union[int, bool][source]

The default value to populate undefined sections with. Read Only

property dtype: Type[dtype][source]

The numpy dtype for the arrays. Read Only.

get_section(sy)[source]

Get the section array for a given section index.

If the section is not defined it will be populated using create_section()

Parameters

sy (Union[int, integer]) – The section index to get.

Return type

ndarray

Returns

Numpy array for this section

has_section(sy)[source]

Check if the array for a given section exists. :param cy: The section y index :rtype: bool :return: True if the array exists, False otherwise

property section_shape: Tuple[int, int, int][source]

The x, y and z size of a section in the original array.

property sections: Iterable[int][source]

An iterable of the section defined in the array.

property shape: Tuple[int, Union[int, float], int][source]

The size of the array in the x, y and z axis. Read Only

property size_x: int[source]

The size of the array in the x axis. Read Only

property size_y: float[source]

The size of the array in the y axis. Is always math.inf for the unbounded variant. Read Only

property size_z: int[source]

The size of the array in the z axis. Read Only

property slice_x: slice[source]

The slice in the x axis into the original array. Read Only

property slice_y: slice[source]

The slice in the y axis into the original array. Read Only

property slice_z: slice[source]

The slice in the z axis into the original array. Read Only

property slices_tuple: Tuple[Tuple[int, int, int], Tuple[int, int, int], Tuple[int, int, int]][source]

The slices data in the x, y and z axis into the original array. Read Only

property start: Tuple[int, int, int][source]

The minimum x, y and z of the slice within the original array. Read Only

property start_x: int[source]

The minimum x value of the slice within the original array. Read Only

property start_y: Optional[int][source]

The minimum y value of the slice within the original array. Read Only

property start_z: int[source]

The minimum z value of the slice within the original array. Read Only

property step: Tuple[int, int, int][source]

The step count of the slice in the x, y and z axis. Read Only

property step_x: int[source]

The step count of the slice in the x axis. Read Only

property step_y: int[source]

The step count of the slice in the y axis. Read Only

property step_z: int[source]

The step count of the slice in the z axis. Read Only

property stop: Tuple[int, int, int][source]

The maximum x value of the slice within the original array. Read Only

property stop_x: int[source]

The maximum x value of the slice within the original array. Read Only

property stop_y: Optional[int][source]

The maximum y value of the slice within the original array. Read Only

property stop_z: int[source]

The maximum z value of the slice within the original array. Read Only