Skip to main content

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.

PyPI - Python Version PyPI PyPI - Downloads Commits since latest release Documentation Status

Installation

Litemapy is available on pypi:

pip install litemapy

Features:

  • Read and write .litematic files
  • Full support for litematics' regions concept
  • Full block storage support
  • Full support for basic metadata handling (author, name, description, block count and total volume)
  • Partial support for entities
  • Partial support for tile entities
  • Partial support for pending block updates
  • Partial support for preview images

Documentation

Documentation is available on ReadTheDocs: litemapy.rtfd.io.

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.block_positions():
    if round(((x-10)**2 + (y-10)**2 + (z-10)**2)**.5) <= 10:
        reg[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[x, 10, z]
        if b.id == "minecraft:air":
            print(" ", end="")
        else:
            print("#", end='')
    print()

When ran, we get the expected output:

       #######       
     ###########     
    #############    
   ###############   
  #################  
 ################### 
 ################### 
#####################
#####################
#####################
#####################
#####################
#####################
#####################
 ################### 
 ################### 
  #################  
   ###############   
    #############    
     ###########     
       #######

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

litemapy-0.11.0b0.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litemapy-0.11.0b0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file litemapy-0.11.0b0.tar.gz.

File metadata

  • Download URL: litemapy-0.11.0b0.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for litemapy-0.11.0b0.tar.gz
Algorithm Hash digest
SHA256 2d9e1c93b58d048de1bda18ff8c5ec34d580753aa5f5c712e03ecbf02cf7ad56
MD5 40cdd0fc3a171c873787c418c2aaafbe
BLAKE2b-256 8f62300bcc82e3520394b9f98fb4390f139460bf46a01e89f61b52e5cbd469d5

See more details on using hashes here.

File details

Details for the file litemapy-0.11.0b0-py3-none-any.whl.

File metadata

  • Download URL: litemapy-0.11.0b0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for litemapy-0.11.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 18af0f847037413b9300b01c8a3179583bab25ca5a17853552abebc665545eb2
MD5 726340b7c7888751e9cc25b7fa584fa3
BLAKE2b-256 76f954e3e36d1906e272505305fdc40fc3050ba67f3c7ffad3552ec673ab400b

See more details on using hashes here.

Supported by

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