amulet.api.chunk.biomes module

class amulet.api.chunk.biomes.Biomes(array=None)[source]

Bases: object

Biomes is a class used to store a 2D biome array and/or 3D biome array and facilitate switching between them.

There are three states biomes can be in.

The first is a blank state where no biomes are defined. This is used when a chunk is partially generated and the biomes array has not be created.

The second is a 2D array of size (16, 16) used for old Java worlds and Bedrock worlds.

The last is the 3D state used since Java 1.15. See Biomes3D for more information.

__init__(array=None)[source]

Construct a new instance of Biomes

Parameters

array (Union[ndarray, Biomes3D, Dict[int, ndarray], None]) – The array to initialise with. Can be None or not defined to have the empty state.

to_raw()[source]

Don’t use this method. Use to pickle data.

Return type

Tuple[BiomesShape, Optional[ndarray], Optional[Dict[int, ndarray]]]

classmethod from_raw(dimension, d2, d3)[source]

Don’t use this method. Use to unpickle data.

Return type

Biomes

property dimension: BiomesShape[source]

The number of dimensions the data has

BiomesShape.ShapeNull when there is no data. Will error if you try accessing data from it without converting to one of the other formats.

BiomesShape.Shape2D when the data is a 2D (16, 16) numpy array.

BiomesShape.Shape3D when the data is a 3D (4, inf, 4) Biome3D array made of sections of size (4, 4, 4).

convert_to_2d()[source]

Convert the data to the 2D 16x16 format from whatever format it was in.

If it was in the Null state it will be initialised with the first entry in the BiomeManager.

In this mode this class will behave like a numpy array.

convert_to_3d()[source]

Convert the data to the 3D (4, inf, 4) format from whatever format it was in.

If it was in the Null state it will be initialised with the first entry in the BiomeManager.

In this mode this class will behave like the Biome3D class.

class amulet.api.chunk.biomes.BiomesShape(value)[source]

Bases: IntEnum

An enum of the different states the Biomes class can be in.

>>> ShapeNull = 0  # The biome array does not exist
>>> Shape2D = 2  # The biome array is a 2D array
>>> Shape3D = 3  # The biome array is a 3D array
ShapeNull = 0[source]
Shape2D = 2[source]
Shape3D = 3[source]