amulet.api.chunk
package¶
- class amulet.api.chunk.chunk.Chunk(cx, cz)[source]¶
Bases:
Changeable
A class to represent a chunk that exists in a Minecraft world
- pickle()[source]¶
Serialise the data in the chunk using pickle and return the resulting bytes.
- Return type
- Returns
Pickled output.
- classmethod unpickle(pickled_bytes, block_palette, biome_palette)[source]¶
Deserialise the pickled input and unpack the data into an instance of
Chunk
- Parameters
block_palette (
BlockManager
) – The instance ofBlockManager
associated with the level.biome_palette (
BiomeManager
) – The instance ofBiomeManager
associated with the level.
- Return type
- Returns
An instance of
Chunk
containing the unpickled data.
- property changed: bool[source]¶
Has the chunk changed since the last undo point. Is used to track which chunks have changed.
>>> chunk = Chunk(0, 0) >>> # Run this to notify that the chunk data has changed. >>> chunk.changed = True
- Setter
Set this to
True
if you have modified the chunk in any way.- Returns
True
if the chunk has been changed since the last undo point,False
otherwise.
- property changed_time: float[source]¶
The last time the chunk was changed
Used to track if the chunk was changed since the last save snapshot and if the chunk model needs rebuilding.
- property blocks: Blocks[source]¶
The block array for the chunk.
This is a custom class that stores a numpy array per sub-chunk.
The values in the arrays are indexes into
block_palette
.
- get_block(dx, y, dz)[source]¶
Get the universal Block object at the given location within the chunk.
- Parameters
- Return type
- Returns
The universal Block object representation of the block at that location
- set_block(dx, y, dz, block)[source]¶
Set the universal Block object at the given location within the chunk.
- property block_palette: BlockManager[source]¶
The block block_palette for the chunk.
Usually will refer to the level’s global block_palette.
- property biomes: Biomes[source]¶
The biome array for the chunk.
This is a custom class that stores numpy arrays. See the
Biomes
documentation for more information.The values in the arrays are indexes into
biome_palette
.
- property biome_palette: BiomeManager[source]¶
The biome block_palette for the chunk.
Usually will refer to the level’s global biome_palette.
- property entities: EntityList[source]¶
Property that returns the chunk’s entity list. Setting this property replaces the chunk’s entity list
- Returns
A list of all the entities contained in the chunk
- property block_entities: BlockEntityDict[source]¶
Property that returns the chunk’s block entity list. Setting this property replaces the chunk’s block entity list
- Returns
A list of all the block entities contained in the chunk