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.
- 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
sy (
Union
[int
,integer
]) – The section index to assign the array to.section (
ndarray
) – The array to assign to the section. The shape must equalsection_shape
.
- create_section(sy)[source]¶
Create a section array at the given location using the default value and dtype.
- property default_value: Union[int, bool][source]¶
The default value to populate undefined sections with. 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()
- 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 shape: Tuple[int, Union[int, float], int][source]¶
The size of the array in the x, y and z 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 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 stop: Tuple[int, int, int][source]¶
The maximum x value of the slice within the original array. Read Only