Read and write Litematica's Minecraft schematics files
Project description
Litemapy
Litemapy's goal is to provide an easy to use way to read and edit Litematica's schematic file format in python. Litematica is Minecraft mod by maruohon.
Example
Here is a basic example of creating a schematic, and of reading one:
from litemapy import Schematic, Region, BlockState
# Shortcut to create a schematic with a single region
reg = Region(0, 0, 0, 21, 21, 21)
schem = reg.as_schematic(name="Planet", author="SmylerMC", description="Made with litemapy")
# Create the block state we are going to use
block = BlockState("minecraft:light_blue_concrete")
# Build the planet
for x, y, z in reg.allblockpos():
if round(((x-10)**2 + (y-10)**2 + (z-10)**2)**.5) <= 10:
reg.setblock(x, y, z, block)
# Save the schematic
schem.save("planet.litematic")
# Load the schematic and get its first region
schem = Schematic.load("planet.litematic")
reg = list(schem.regions.values())[0]
# Print out the basic shape
for x in reg.xrange():
for z in reg.zrange():
b = reg.getblock(x, 10, z)
if b.blockid == "minecraft:air":
print(" ", end="")
else:
print("#", end='')
print()
When ran, we get the expected output:
#######
###########
#############
###############
#################
###################
###################
#####################
#####################
#####################
#####################
#####################
#####################
#####################
###################
###################
#################
###############
#############
###########
#######
Installation
Litemapy is available on pypi: pip install litemapy
Content
Litemapy is still new and only has basic functionalities, it lacks support for some of Litematica's, notably:
- Entities are not supported.
- Tile entities are not supported.
- Pending block updates are not supported.
- Preview screenshots are not supported.
- Legacy Schematica schematics are not supported at all, only the newer Litematica format is.
Documentation
Sadly, documentation is yet to be written.
Dependencies
The only direct dependency is nbtlib, which is available on pypi and should install automatically with pip.
However, if you wish to play around with the code, please not that the test suite compares Litemapy's behavior with Litematica's to make sure it matches, and therefore needs a valid JDK installation and Py4J. Those specific tests have only been tested on POSIX systems.
Project details
Release history Release notifications | RSS feed
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
Hashes for litemapy-0.4.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 462cb22d479ac1dc1c242b72346029e11ce1174597e24267f603310135025176 |
|
MD5 | dd2f862f0e8eaa81e678222d740bdd5c |
|
BLAKE2b-256 | 160ae18e6762f87be32b0c1981e1d0bbdec16299f088a6a4e9429accde82588c |