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: NumericalRegistry

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

property block_registry: NumericalRegistry

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.

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]

transform_universal_block(block, transform, mode=RotateMode.Nearest)[source]

Rotate the given universal block by the given angle.

Parameters
  • block (Block) – The block to rotate. Must be a valid block from the universal format.

  • angle – The angle around the x, y and z axis to rotate.

  • mode (RotateMode) – The rotation mode. See RotateMode for more information

Return type

Block

Returns

The transformed block state

property universal_format: Version

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

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.

PyMCTranslate.py3.api.translation_manager.translation_manager.log = <Logger PyMCTranslate.py3.api.translation_manager.translation_manager (INFO)>[source]

Structure:

TranslationManager

Version : bedrock_1_7_0 Version : java_1_12_0 Version : java_1_13_0 Version : universal