Tool to translate old Minecraft formatting codes to the modern JSON format
Project description
JSONTextMC
Minecraft uses two main systems for formatting text.
The Legacy format uses section symbols and hexadecimal color coding, while the JSON format uses key-value pairs to color individual parts of text.
JSONTextMC is a module for translating legacy messages to and from JSON-formatted text.
Output is not valid JSON by itself, it must be translated into JSON with json.loads()
.
Strict modes and inheritance of various JSON elements can be controlled.
Requires Python 3.10+.
Table of Contents
Installation
Use the package manager pip to install JSONTextMC.
python3 -m pip install jsontextmc
See the package page on PyPi here.
Use the output in any place where a JsonTextComponent is accepted (e.g. /tellraw, /title, .json files).
Support
Supports all Vanilla Minecraft formatting codes:
- All color codes
- All formatting codes
- Hexidecimal
- Alows both
#
andx
as prefix codes
- Alows both
Usage
Read the PyDocs in the module for details about usage. Essentially:
to_json()
: Legacy -> JSONfrom_json()
: JSON -> Legacy
Strict and inheritance modes control how legacy text is handled and translated into JSON.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
If there is an individual issue you would like to bring attention to, please open one here.
License
Distributed under the GPLv3 license. (visit GNU's website)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jsontextmc-3.2.0.tar.gz
.
File metadata
- Download URL: jsontextmc-3.2.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99f41c768937b54751d11a04309819c68b87f5680975781b52e35929e0ce809e |
|
MD5 | bb9bb4baaddf03ab8fa8c59c8083f8d5 |
|
BLAKE2b-256 | 53880cf1dabd1dbc11630c791ff39edd31fb94648764e27cd341a4bb800289c1 |
File details
Details for the file jsontextmc-3.2.0-py3-none-any.whl
.
File metadata
- Download URL: jsontextmc-3.2.0-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b75449c3623ec63ee47fd0af326ca6d14f49134a2c74f2a215f3ebea8ad6016b |
|
MD5 | aeb89f3d041472f4d9b3369e97269bed |
|
BLAKE2b-256 | 891091ab0fb36b0a0a412edf2eaaa5f9e361db6089c7c0edc341695280174bb6 |