amulet.api.level.base_level.chunk_manager
package¶
- class amulet.api.level.base_level.chunk_manager.ChunkManager(level, history_db)[source]¶
Bases:
DatabaseHistoryManager
The ChunkManager class is a class that handles chunks within a world.
It handles the temporary database of chunks in RAM that can be directly modified.
It handles a serialised version of the chunks on disk to reduce RAM usage.
It also contains a history manager to allow undoing and redoing of changes.
- DoesNotExistError[source]¶
alias of
ChunkDoesNotExist
- LoadError[source]¶
alias of
ChunkLoadError
- __init__(level, history_db)[source]¶
Construct a
ChunkManager
instance.Should not be directly used by third party code.
- Parameters
level (
BaseLevel
) – The world that this chunk manager is associated with
- unload(safe_area=None)[source]¶
Unload all chunks from the temporary database that are not in the safe area.
- all_chunk_coords(dimension)[source]¶
The coordinates of every chunk in this world.
This is the combination of chunks saved to the world and chunks yet to be saved.
- get_chunk(dimension, cx, cz)[source]¶
Gets the
Chunk
object at the specified chunk coordinates.This may be a
Chunk
instance if the chunk exists, None if it is known to not exist orChunkDoesNotExist
will be raised if there is no record so it is unknown if it exists or not.Use has_chunk to check if there is a record of the chunk.
- Parameters
- Return type
- Returns
A Chunk instance or None
- Raises
ChunkDoesNotExist
: If the chunk does not exist (was deleted or never created)
- create_undo_point()[source]¶
Find what has changed since the last undo point and optionally create a new undo point.
- Return type
- Returns
Was an undo point created. If there were no changes no snapshot will be created.
- create_undo_point_iter()[source]¶
Find all entries in the temporary database that have changed since the last undo point and create a new undo point.
- restore_last_undo_point()[source]¶
Restore the state of the database to what it was when
create_undo_point_iter()
was last called.