1
Fork 0
mirror of https://github.com/Steffo99/lihzahrd.git synced 2024-10-16 06:27:29 +00:00
Terraria world parser in Python
Find a file
2024-09-04 19:32:51 +02:00
.github Configure dependabot 2023-03-06 02:41:39 +01:00
.media 3.1.1: Improve project metadata 2024-09-04 17:05:01 +02:00
docs Update docs 2023-03-06 02:48:53 +01:00
docs_source 🧹 Run Black on all files 2022-02-11 18:05:29 +01:00
src/lihzahrd Migrate project to uv 2024-09-04 19:32:51 +02:00
.gitattributes Update git data 2019-08-07 14:08:25 +02:00
.gitignore 🧹 Remove __main__.py 2021-06-07 10:16:32 +02:00
CONTRIBUTING.md 3.1.1: Improve project metadata 2024-09-04 17:05:01 +02:00
LICENSE.txt 3.1.1: Improve project metadata 2024-09-04 17:05:01 +02:00
publish.bat publish: 2.0.0a1 2020-06-10 19:54:56 +02:00
README.md 3.1.1: Improve project metadata 2024-09-04 17:05:01 +02:00
uv.lock Migrate project to uv 2024-09-04 19:32:51 +02:00

Lihzahrd

Terraria game world parser for Python.

Available on PyPI

Full documentation

Installation

Lihzahrd can be installed from PyPI like any other public Python package.

Using uv, that means:

uv add lihzahrd

Usage

You can open a world file and get a World object by calling:

import lihzahrd
world = lihzahrd.World.create_from_file("filename.wld")

It will take a while to process: a small Terraria world contains more than 5 million tiles!

Once you have a World object, you can use all data present in the save file by accessing its attributes.

Warning

Maliciously designed Terraria worlds can drain system resources, crash the interpreter, or possibly do other evil things!

Make sure you trust worlds before parsing them!

Documentation

The documentation is available here.

If you know something that is missing in the documentation, please let me know with an issue!

PyPy

lihzahrd is compatible with PyPy, an alternative implementation on Python!

If you think that parsing a world takes too much time, you can use PyPy to reduce the required time by a factor of ~3!

Benchmarks

Time to parse the same large world:

  • CPython took 11.45 s.
  • Pypy took 3.57 s!

Building docs

You can build the docs by entering the docs_source folder and running make html, then committing the whole docs folder.

References used

See also