API Reference

Contents

API Reference#

Consts#

SUPPORTED_FORMATS: set[FileFormat] = {FileFormat.ITEMNAMES, FileFormat.MCSA, FileFormat.MCSB, FileFormat.MCVD, FileFormat.MIC, FileFormat.NBT, FileFormat.OL, FileFormat.TEXARR}#

Files formats (suffixes without dot) that can be converted.

SUPPORTED_SUFFIXES: set[str] = {'.dat', '.mcsa', '.mcsb', '.mcvd', '.mic', '.nbt', '.ol', '.texarr'}#

Files suffixes that can be converted.

NBT_FILENAMES: set[str] = {'common', 'itemnames.dat', 'prefs', 'sd0', 'sd1', 'sd2', 'sd3', 'sd4'}#

Files names that can be converted.

class FileSignature[source]#

File magic number for formats (big-endian).

MCSA = b'MCSA'#
MCAL = b'MCAL'#
MIC = b'\x89MIC'#
OL = b'\n\x95#\xfd'#
DDS = b'DDS '#
PNG = b'\x89PNG'#
GLTF = b'glTF'#
MS3D = b'MS3D000000'#
class Factor[source]#

Integer max range for integer type.

I8 = 127#
U8 = 255#
I16 = 32767#
U16 = 65535#
class OlString[source]#

Xor encoded zero-end string.

SIZE = 17#

16 encoded bytes and last 0x00 byte.

XOR = 103#
NULL = 71#
class CubemapFaces[source]#

Dds cubemap faces.

FACES = {'+x', '+y', '+z', '-x', '-y', '-z'}#
COUNT = 6#
class McsaModel[source]#

Mcsa model constants.

DECIMALS = 6#
ROOT_BONE_ID = -1#
GEOMETRY_LIMIT = 1000000#

Safety limit to prevent memory overflow on corrupted files.

class McsaUnits[source]#

Mcsa structures elements count.

POSITIONS = 4#
TEXTURES = 2#
NORMALS = 4#
POLYGONS = 3#
BONES = 6#
FRAMES = 7#
class CLI[source]#

Command line interface constants.

FORMATS = "Supported Formats: ['.dat', '.mcsa', '.mcsb', '.mcvd', '.mic', '.nbt', '.ol', '.texarr']"#
EPILOG = "Supported Formats: ['.dat', '.mcsa', '.mcsb', '.mcvd', '.mic', '.nbt', '.ol', '.texarr']"#
NBT = "Supported NBTs: ['common', 'itemnames.dat', 'prefs', 'sd0', 'sd1', 'sd2', 'sd3', 'sd4']"#
EXCEPTION = '[b yellow]Input file appears to be corrupted or invalid.[/]'#
PAUSE = '\nPress any key to exit...'#
NON_SKELETAL_FORMATS: Sequence[FileFormat] = (FileFormat.OBJ,)#
NON_ANIMATION_FORMATS: Sequence[FileFormat] = (FileFormat.OBJ, FileFormat.MS3D, FileFormat.DAE)#
class OutputFormats[source]#

Supported output formats for file data types.

MODELS: Sequence[FileFormat] = (FileFormat.OBJ, FileFormat.GLB, FileFormat.DAE, FileFormat.MS3D)#
TEXTURES: Sequence[FileFormat] = (FileFormat.DDS,)#
IMAGES: Sequence[FileFormat] = (FileFormat.PNG,)#
TEXARR: Sequence[FileFormat] = (FileFormat.ZIP,)#
class DefaultModelFormats[source]#

Default model formats for cases where no preference is specified.

STANDARD: Sequence[FileFormat] = (FileFormat.OBJ,)#
SKELETON: Sequence[FileFormat] = (FileFormat.GLB,)#

Enums#

class FileFormat(value)[source]#

Bases: StrEnum

File suffix (without dot).

DAE = 'dae'#
DDS = 'dds'#
GLB = 'glb'#
JSON = 'json'#
MCAL = 'mcal'#
MCSA = 'mcsa'#
MCSB = 'mcsb'#
MCVD = 'mcvd'#
MIC = 'mic'#
MS3D = 'ms3d'#
NBT = 'nbt'#
OBJ = 'obj'#
OL = 'ol'#
PNG = 'png'#
TEXARR = 'texarr'#
ZIP = 'zip'#
ITEMNAMES = 'dat'#
property suffix#
class FileType(value)[source]#

Bases: StrEnum

File content type.

NONE = 'none'#
MODEL = 'model'#
TEXTURE = 'texture'#
IMAGE = 'image'#
TEXARR = 'texarr'#
NBT = 'nbt'#
class FileMode(value)[source]#

Bases: StrEnum

File open mode.

RB = 'rb'#
READ = 'rb'#
WB = 'wb'#
WRITE = 'wb'#
AB = 'ab'#
APPEND = 'ab'#
PLUS = '+'#
class ByteOrder(value)[source]#

Bases: StrEnum

File content bytes order.

NATIVE = '@'#
STANDARD = '='#
LITTLE = '<'#
BIG = '>'#
NETWORK = '!'#
class UnicodeErrors(value)[source]#

Bases: StrEnum

Unicode errors handling policy.

STRICT = 'strict'#

Raise UnicodeDecodeError on invalid bytes

IGNORE = 'ignore'#

Skip invalid bytes silently

REPLACE = 'replace'#

Replace invalid bytes with a replacement marker (�)

BACKSLASH = 'backslashreplace'#
BACKSLASHREPLACE = 'backslashreplace'#

Replace with backslash-escaped sequences (xHH)

NAME = 'namereplace'#
NAMEREPLACE = 'namereplace'#

Replace with N{…} escape sequences

XML = 'xmlcharrefreplace'#
XMLCHARREFREPLACE = 'xmlcharrefreplace'#

Replace with XML/HTML numeric entities (&#…;)

SURROGATE = 'surrogateescape'#
SURROGATEESCAPE = 'surrogateescape'#

Preserve invalid bytes as surrogate codes

class StructFormat(value)[source]#

Bases: StrEnum

Native C-type struct format codes.

BOOL = '?'#

BOOL 1 byte [False, True]

Type:

boolean

I8 = 'b'#

BYTE 1 byte [-128, 127]

Type:

signed char

I16 = 'h'#

WORD 2 bytes [-32768, 32767]

Type:

signed short

I32 = 'i'#

DWORD 4 bytes [-2147483648, 2147483647]

Type:

signed int

I64 = 'q'#

QWORD 8 bytes [-9223372036854775808, 9223372036854775807]

Type:

signed long long

U8 = 'B'#

BYTE 1 byte [0, 255]

Type:

unsigned char

U16 = 'H'#

WORD 2 bytes [0, 65535]

Type:

unsigned short

U32 = 'I'#

DWORD 4 bytes [0, 4294967295]

Type:

unsigned int

U64 = 'Q'#

QWORD 8 bytes [0, 18446744073709551615]

Type:

unsigned long long

F16 = 'e'#

half-precision 2 bytes

Type:

float

F32 = 'f'#

single-precision 4 bytes

Type:

double

F64 = 'd'#

double-precision 8 bytes

Type:

double

F#

StructFormat Alias.

class ConsoleLabel(value)[source]#

Bases: StrEnum

Colored labels for console output.

INFO = '[b blue]INFO:[/]'#
HINT = '[b cyan]HINT:[/]'#
WARN = '[b yellow]WARN:[/]'#
ERROR = '[b red]ERROR:[/]'#
INVALID = '[b red]INVALID INPUT:[/]'#
EXCEPTION = '[b red]UNEXPECTED ERROR:[/]'#
L#

ConsoleLabel Alias.