Skip to main content

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 # and x as prefix codes

Usage

Read the PyDocs in the module for details about usage. Essentially:

  • to_json(): Legacy -> JSON
  • from_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

jsontextmc-3.2.0.tar.gz (16.1 kB view hashes)

Uploaded Source

Built Distribution

jsontextmc-3.2.0-py3-none-any.whl (16.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page