minecraftschematics


Nameminecraftschematics JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryA library for working with Minecraft Schematics in Python with numpy
upload_time2023-07-22 19:13:40
maintainer
docs_urlNone
authorGabriel Werneck Paiva
requires_python
licenseMIT
keywords python minecraft schematic numpy nbtlib
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Minecraft Schematics - Minecraft Schematic Library

Minecraft Schematics is a Python library for working with Minecraft schematic files. It provides a simple and convenient way to read and process schematic files used in Minecraft.

The library is based on the Minecraft Schematic format version 2.

## Features

- Load Minecraft schematic files (.schematic) and read their contents.
- Access schematic size and dimensions (width, height, length).
- Get block data as a 3D numpy array representing the blocks in the schematic.
- Access individual blocks' information, including type and properties.

## Installation

To install PySchematic, you can use pip:

```bash
pip install pyschematic
```

## Usage

Here's a quick guide on how to use the `minecraftschematics` library:

### Schematic Class

The `Schematic` class is the main class of the library. It is used to load schematic files with the `load` method and access the schematic's data.

```python
from minecraftschematics import Schematic

schematic = Schematic().load('path/to/your/schematic_file.schematic')

print(schematic.size)     # Output: (3, 4, 5)
print(schematic.width)    # Output: 3
print(schematic.height)   # Output: 4
print(schematic.length)   # Output: 5

# Get block data as a 3D numpy array
blocks = schematic.blocks
print(blocks.shape)      # Output: (3, 4, 5)
print(blocks[0, 0, 0])   # Output: Block(minecraft:redstone_wire[east=none,north=side,power=0,south=side,west=none])

# Get the positions of each block as their schematic id in a 1D numpy array
block_data = schematic.block_data
print(block_data)        # Output: [1, 2, 1, 1, 1, 3...]

# Get the offset of the schematic
offset = schematic.offset
print(offset)            # Output: (15, 3, 4)

# Or for the WorldEdit offset
we_offset = schematic.worldedit_offset
print(we_offset)         # Output: (15, 3, 4)

# Get additional metadata (if available)
metadata = schematic.metadata
print(metadata)          # Output: { 'Metadata_key_1': 'Metadata_value_1', ... }
```

**Note**: The schematic loading process will verify the schematic's version and raise an exception if it is not compatible with version 2. To force loading the schematic (not recommended), you can pass `force=True` to the `load` method.

## Requirements

- Python 3.10+
- numpy
- nbtlib

## Contributing

If you have any suggestions, bug reports, or feature requests, please feel free to open an issue or submit a pull request on [GitHub](https://github.com/gwerneckpaiva/pyschematic).

## License

This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).

---
*This project is based on the Minecraft Schematic format version 2.*

**Author**: Gabriel Werneck Paiva

**Email**: gwerneckpaiva@gmail.com

**GitHub**: [Your GitHub Profile](https://github.com/gwerneckpaiva/)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "minecraftschematics",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,minecraft,schematic,numpy,nbtlib",
    "author": "Gabriel Werneck Paiva",
    "author_email": "gwerneckpaiva@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/de/b6/a7aa07edfeb0e14a06b46aab0588c7a276b07d52374d7194e09116dff9f9/minecraftschematics-0.1.1.tar.gz",
    "platform": null,
    "description": "# Minecraft Schematics - Minecraft Schematic Library\n\nMinecraft Schematics is a Python library for working with Minecraft schematic files. It provides a simple and convenient way to read and process schematic files used in Minecraft.\n\nThe library is based on the Minecraft Schematic format version 2.\n\n## Features\n\n- Load Minecraft schematic files (.schematic) and read their contents.\n- Access schematic size and dimensions (width, height, length).\n- Get block data as a 3D numpy array representing the blocks in the schematic.\n- Access individual blocks' information, including type and properties.\n\n## Installation\n\nTo install PySchematic, you can use pip:\n\n```bash\npip install pyschematic\n```\n\n## Usage\n\nHere's a quick guide on how to use the `minecraftschematics` library:\n\n### Schematic Class\n\nThe `Schematic` class is the main class of the library. It is used to load schematic files with the `load` method and access the schematic's data.\n\n```python\nfrom minecraftschematics import Schematic\n\nschematic = Schematic().load('path/to/your/schematic_file.schematic')\n\nprint(schematic.size)     # Output: (3, 4, 5)\nprint(schematic.width)    # Output: 3\nprint(schematic.height)   # Output: 4\nprint(schematic.length)   # Output: 5\n\n# Get block data as a 3D numpy array\nblocks = schematic.blocks\nprint(blocks.shape)      # Output: (3, 4, 5)\nprint(blocks[0, 0, 0])   # Output: Block(minecraft:redstone_wire[east=none,north=side,power=0,south=side,west=none])\n\n# Get the positions of each block as their schematic id in a 1D numpy array\nblock_data = schematic.block_data\nprint(block_data)        # Output: [1, 2, 1, 1, 1, 3...]\n\n# Get the offset of the schematic\noffset = schematic.offset\nprint(offset)            # Output: (15, 3, 4)\n\n# Or for the WorldEdit offset\nwe_offset = schematic.worldedit_offset\nprint(we_offset)         # Output: (15, 3, 4)\n\n# Get additional metadata (if available)\nmetadata = schematic.metadata\nprint(metadata)          # Output: { 'Metadata_key_1': 'Metadata_value_1', ... }\n```\n\n**Note**: The schematic loading process will verify the schematic's version and raise an exception if it is not compatible with version 2. To force loading the schematic (not recommended), you can pass `force=True` to the `load` method.\n\n## Requirements\n\n- Python 3.10+\n- numpy\n- nbtlib\n\n## Contributing\n\nIf you have any suggestions, bug reports, or feature requests, please feel free to open an issue or submit a pull request on [GitHub](https://github.com/gwerneckpaiva/pyschematic).\n\n## License\n\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n\n---\n*This project is based on the Minecraft Schematic format version 2.*\n\n**Author**: Gabriel Werneck Paiva\n\n**Email**: gwerneckpaiva@gmail.com\n\n**GitHub**: [Your GitHub Profile](https://github.com/gwerneckpaiva/)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library for working with Minecraft Schematics in Python with numpy",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [
        "python",
        "minecraft",
        "schematic",
        "numpy",
        "nbtlib"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "54e6c7aabe962272f55abf0b8c09374fc4e0216b71069fbc990994e379c5fc3a",
                "md5": "fd6ff2d9e92c104947e991abd2db8d9a",
                "sha256": "c86824c518b32938f5cafb8d2e39eb11abdee2d07d2a55d0b01af187e0b7b35e"
            },
            "downloads": -1,
            "filename": "minecraftschematics-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fd6ff2d9e92c104947e991abd2db8d9a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5991,
            "upload_time": "2023-07-22T19:13:37",
            "upload_time_iso_8601": "2023-07-22T19:13:37.926914Z",
            "url": "https://files.pythonhosted.org/packages/54/e6/c7aabe962272f55abf0b8c09374fc4e0216b71069fbc990994e379c5fc3a/minecraftschematics-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "deb6a7aa07edfeb0e14a06b46aab0588c7a276b07d52374d7194e09116dff9f9",
                "md5": "72f3361ce67ef9155cde5c28216ffbb4",
                "sha256": "30e52ff767c84820324432bcdc121bdd2c0d95fa95a65a83dc5307023f96dfa5"
            },
            "downloads": -1,
            "filename": "minecraftschematics-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "72f3361ce67ef9155cde5c28216ffbb4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6021,
            "upload_time": "2023-07-22T19:13:40",
            "upload_time_iso_8601": "2023-07-22T19:13:40.275463Z",
            "url": "https://files.pythonhosted.org/packages/de/b6/a7aa07edfeb0e14a06b46aab0588c7a276b07d52374d7194e09116dff9f9/minecraftschematics-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-22 19:13:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "minecraftschematics"
}
        
Elapsed time: 0.09180s