EntityTranslator class

class PyMCTranslate.py3.api.version.translators.entity.EntityTranslator(translation_manager, parent_version, database, *_)[source]

Bases: PyMCTranslate.py3.api.version.translators.base.BaseTranslator

base_names(namespace, force_blockstate=False)

A list of all the valid base names present in a given namespace for this object type.

Parameters
  • namespace (str) – A namespace string as found using the namespaces method

  • force_blockstate (bool) – True to get the blockstate format. False to get the native format (these are sometimes the same)

Return type

List[str]

Returns

A list of base names

from_universal(entity, force_blockstate=False)[source]

A method to translate a given Entity object from the Universal format to the format of this class instance.

Parameters
  • entity (Entity) – The entity to translate

  • force_blockstate (bool) – True to get the blockstate format. False to get the native format (these are sometimes the same)

Return type

Union[Tuple[Block, Optional[BlockEntity]], Tuple[Entity, None]]

Returns

There are two formats that can be returned. The first is a Block and an optional BlockEntity. The second is an Entity and None.

get_mapping_from_universal(namespace, base_name, force_blockstate=False)

Get the mapping file for the requested object from the universal format to this version format.

Parameters
  • namespace (str) – A namespace string as found using the namespaces method

  • base_name (str) – A base name string as found using the base_name method

  • force_blockstate (bool) – True to get the blockstate format. False to get the native format (these are sometimes the same)

Return type

List[dict]

Returns

A list of mapping functions to apply to the object

get_mapping_to_universal(namespace, base_name, force_blockstate=False)

Get the mapping file for the requested object from this version format to the universal format.

Parameters
  • namespace (str) – A namespace string as found using the namespaces method

  • base_name (str) – A base name string as found using the base_name method

  • force_blockstate (bool) – True to get the blockstate format. False to get the native format (these are sometimes the same)

Return type

List[dict]

Returns

A list of mapping functions to apply to the object

get_specification(namespace, base_name, force_blockstate=False)

Get the specification file for the requested object.

Parameters
  • namespace (str) – A namespace string as found using the namespaces method

  • base_name (str) – A base name string as found using the base_name method

  • force_blockstate (bool) – True to get the blockstate format. False to get the native format (these are sometimes the same)

Return type

dict

Returns

A dictionary containing the specification for the object

namespaces(force_blockstate=False)

A list of all the valid namespaces for this object type.

Parameters

force_blockstate (bool) – True to get the blockstate format. False to get the native format (these are sometimes the same)

Return type

List[str]

Returns

A list of all the namespaces

to_universal(entity, force_blockstate=False)[source]

A method to translate a given Entity object to the Universal format.

Parameters
  • entity (Entity) – The entity to translate

  • force_blockstate (bool) – True to get the blockstate format. False to get the native format (these are sometimes the same)

Return type

Entity

Returns

The translated Entity