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.
-
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 translateforce_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
- Return type
- 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
- Return type
- 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
- Return type
- Returns
A dictionary containing the specification for the object
-
namespaces
(force_blockstate=False)¶ A list of all the valid namespaces for this object type.
-
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 translateforce_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
-