TranslationManager class

class PyMCTranslate.py3.api.translation_manager.translation_manager.TranslationManager(json_path)[source]

Bases: object

The TranslationManager is a container for a number of different Version classes.

Each Version class contains the data for a given game platform and version.

The TranslationManager exists to be a loader and accessor for the Version classes as well as containing some extra data.

Important

This class should not be directly initiated. You should instead use PyMCTranslate.new_translation_manager() to request that a new translation manager be created.

Important

If you are using this library with Amulet an instance of this class will already exist in World.translation_manager.

If you are for some reason directly interacting with the amulet_core’s WorldFormatWrapper class it too has a translation_manager attribute.

property biome_registry

A class used to register the biome string name that pairs with the arbitrary numerical id stored in chunk.

Return type

NumericalRegistry

property block_registry

A class used to register the block string name that pairs with the arbitrary numerical id stored in chunk. This is only used in worlds where the blocks ids are stored in numerical format.

Return type

NumericalRegistry

get_version(platform, version_number)[source]

Get a Version class for the requested platform and version number

Parameters
  • platform (str) – The platform name (use TranslationManager.platforms to get the valid platforms)

  • version_number (Union[int, Tuple[int, …], List[int]]) – The version number or DataVersion (use TranslationManager.version_numbers to get version numbers for a given platforms)

Return type

Version

Returns

The Version class for the given inputs.

Raise

Raises a KeyError if it does not exist.

platforms()[source]

Get a list of all the platforms there are Version classes for. Currently these are ‘java’, ‘bedrock’ and ‘universal’

Return type

List[str]

property universal_format

A simple way to access the Version class for the Universal format.

Return type

Version

Returns

The Version class for the Universal format.

version_numbers(platform)[source]

Get a list of all the version numbers there are Version classes for, for a given platform.

Parameters

platform (str) – The platform name (use TranslationManager.platforms to get the valid platforms)

Return type

List[Tuple[int, int, int]]

Returns

The a list of version numbers (tuples) for a given platform.

Raise

Raises a KeyError if the platform is not present.