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.10.0b0.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

litemapy-0.10.0b0-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: litemapy-0.10.0b0.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for litemapy-0.10.0b0.tar.gz
Algorithm Hash digest
SHA256 2017d31e7fd02dca316de2a6254113fd8e7322aca649ad5369dbdf8f5baf9c45
MD5 89f8cafc4352193311bcaa24e91097b4
BLAKE2b-256 88c2373b4f56977775dae23754d024ac382c10c0b7423ae155703744e693fe3d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: litemapy-0.10.0b0-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for litemapy-0.10.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb07cf7ce7cc35af17cd28e33b8e8ac7c5bda9457916fc926e2c9075fcb2dcf0
MD5 8d72d56569efe9e5a875016a26140291
BLAKE2b-256 ed55144bbf3c347185236b1e2bab3eb78761531762b23afb9f60432c72922a95

See more details on using hashes here.

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