amulet.api.level.immutable_structure.void_format_wrapper
module¶
- class amulet.api.level.immutable_structure.void_format_wrapper.VoidFormatWrapper(path)[source]¶
Bases:
FormatWrapper
[Tuple
[int
, …]]A custom
FormatWrapper
class that has no associated data.This is just to make the
ImmutableStructure
class happy since it requires aFormatWrapper
class.All methods effectively do nothing.
- __init__(path)[source]¶
Construct a new instance of
FormatWrapper
.This should not be used directly. You should instead use
amulet.load_format()
.- Parameters
path (
str
) – The file path to the serialised data.
- property valid_formats: Dict[str, Tuple[bool, bool]][source]¶
The valid platform and version combinations that this object can accept.
This is used when setting the platform and version in the create_and_open method to verify that the platform and version are valid.
- Returns
A dictionary mapping the platform to a tuple of two booleans to determine if numerical and blockstate are valid respectively.
- property can_add_dimension: bool[source]¶
Can external code register a new dimension.
If False
register_dimension()
will have no effect.
- register_dimension(dimension_identifier)[source]¶
Register a new dimension.
- Parameters
dimension_identifier (
Any
) – The identifier for the dimension.
- property changed: bool[source]¶
Has any data been pushed to the format wrapper that has not been saved to disk.
- commit_chunk(chunk, dimension)[source]¶
Save a universal format chunk to the FormatWrapper database (not the level database)
Call save method to write changed chunks back to the level.
- create_and_open(platform, version, bounds=None, overwrite=False, **kwargs)[source]¶
Remove the data at the path and set up a new database.
You might want to call
exists
to check if something exists at the path and warn the user they are going to overwrite existing data before calling this method.- Parameters
platform (
str
) – The platform the data should use.version (
Union
[int
,Tuple
[int
,...
]]) – The version the data should use.bounds (
Union
[SelectionGroup
,Dict
[str
,Optional
[SelectionGroup
]],None
]) – The bounds for each dimension. If oneSelectionGroup
is given it will be applied to all dimensions.overwrite (
bool
) – Should an existing database be overwritten. If this is False and one exists and error will be thrown.kwargs – Extra arguments as each implementation requires.
- Returns
- load_chunk(cx, cz, dimension)[source]¶
Loads and creates a universal
Chunk
object from chunk coordinates.- Parameters
- Return type
- Returns
The chunk at the given coordinates.
- Raises
ChunkDoesNotExist: If the chunk does not exist (was deleted or never created) ChunkLoadError: If the chunk was not able to be loaded. Eg. If the chunk is corrupt or some error occurred when loading.
- load_player(player_id)[source]¶
Gets the
Player
object that belongs to the specified player idIf no parameter is supplied, the data of the local player should be returned
- Parameters
player_id (
str
) – The desired player id- Return type
Player
- Returns
A Player instance
- property max_world_version: Tuple[str, VersionNumberT][source]¶
The version the world was last opened in.
This should be greater than or equal to the chunk versions found within.
- property multi_selection: bool[source]¶
Does this object support having multiple selection boxes.
If False it will be given exactly 1 selection.
If True can be given 0 or more.
- static pre_save_operation(level)[source]¶
Logic to run before saving. Eg recalculating height maps or lighting.
Must be a generator that yields a number and returns a bool.
The yielded number is the progress from 0 to 1.
The returned bool is if changes have been made.
- put_raw_chunk_data(cx, cz, data, dimension)[source]¶
Commit the raw chunk data to the FormatWrapper cache.
Call
save()
to push all the cache data to the level.
- property requires_selection: bool[source]¶
Does this object require that a selection be defined when creating it from scratch?
- property selection: SelectionGroup[source]¶
The area that all chunk data must fit within.
- property translation_manager: TranslationManager[source]¶
The translation manager attached to the world.