litematic-to-schematic 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- litematic_to_schematic-1.0.0/LICENSE +21 -0
- litematic_to_schematic-1.0.0/PKG-INFO +188 -0
- litematic_to_schematic-1.0.0/README.md +136 -0
- litematic_to_schematic-1.0.0/pyproject.toml +50 -0
- litematic_to_schematic-1.0.0/setup.cfg +4 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic/__init__.py +19 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic/__main__.py +5 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic/cli.py +42 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic/converter.py +376 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic.egg-info/PKG-INFO +188 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic.egg-info/SOURCES.txt +14 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic.egg-info/dependency_links.txt +1 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic.egg-info/entry_points.txt +5 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic.egg-info/requires.txt +2 -0
- litematic_to_schematic-1.0.0/src/litematic_to_schematic.egg-info/top_level.txt +1 -0
- litematic_to_schematic-1.0.0/tests/test_converter.py +476 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ohualtex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: litematic-to-schematic
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Convert Minecraft Litematica (.litematic) schematics directly to WorldEdit Sponge V2 (.schem) format.
|
|
5
|
+
Author: Ohualtex
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Ohualtex
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Ohualtex/litematic-to-schematic
|
|
29
|
+
Project-URL: Repository, https://github.com/Ohualtex/litematic-to-schematic
|
|
30
|
+
Project-URL: Issues, https://github.com/Ohualtex/litematic-to-schematic/issues
|
|
31
|
+
Keywords: minecraft,litematica,litematic,schematic,schem,worldedit,sponge,lithetic
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
44
|
+
Classifier: Topic :: Games/Entertainment
|
|
45
|
+
Classifier: Topic :: Utilities
|
|
46
|
+
Requires-Python: >=3.8
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
License-File: LICENSE
|
|
49
|
+
Requires-Dist: litemapy
|
|
50
|
+
Requires-Dist: nbtlib
|
|
51
|
+
Dynamic: license-file
|
|
52
|
+
|
|
53
|
+
# π οΈ Litematica to Schematic Converter
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+

|
|
57
|
+

|
|
58
|
+

|
|
59
|
+
-brightgreen.svg)
|
|
60
|
+
|
|
61
|
+
> Read this document in another language:
|
|
62
|
+
> πΉπ· **[TΓΌrkΓ§e (Turkish)](README_TR.md)**
|
|
63
|
+
|
|
64
|
+
A fast, reliable Python CLI tool and library to convert Minecraft **Litematica** (`.litematic`) schematics directly into **WorldEdit / FastAsyncWorldEdit (FAWE)** compatible **Sponge V2** (`.schem`) format.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## π― Purpose
|
|
69
|
+
|
|
70
|
+
In Minecraft, schematic files created by the Fabric/Quilt-based **Litematica** mod (`.litematic`) cannot be loaded directly by **WorldEdit** or **FAWE** plugins running on Forge, NeoForge, Paper, or Spigot servers.
|
|
71
|
+
|
|
72
|
+
This tool parses Litematica files directly at the NBT level without launching a Minecraft client and converts them into standard Sponge V2 `.schem` files.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## β¨ Features
|
|
77
|
+
|
|
78
|
+
- π§© **Multi-Region Merging & Conflict Policies**: Automatically computes the global bounding box across all regions in a `.litematic` file, aligns relative region offsets, prevents air blocks from erasing solid blocks, and provides configurable conflict resolution (`--on-overlap overwrite|keep-first|error`).
|
|
79
|
+
- π¦ **Sponge V2 NBT Structure & Dynamic `DataVersion`**: Preserves the source schematic's `MinecraftDataVersion` (falling back to `2586` only if missing) and builds a Sponge V2 NBT tree (`Version: 2`).
|
|
80
|
+
- π§° **BlockEntities & Entities Preservation**: Transfers container inventories (chests, barrels, shulker boxes, signs) and entities (armor stands, item frames, paintings, minecarts) with global coordinate alignment, `TileX/Y/Z` recalculation, and `UUID`/`Id` sanitization.
|
|
81
|
+
- π§ **Modded & Vanilla Namespace Integrity**: Preserves custom mod namespaces (e.g., `create:brass_casing`, `ae2:controller[state=online]`) while automatically prefixing un-namespaced vanilla identifiers with `minecraft:`.
|
|
82
|
+
- π’ **LEB128 VarInt Byte Encoding**: Encodes block palette indices into signed 8-bit NBT `ByteArray` streams using dynamic LEB128 VarInt encoding, supporting palettes of any size (`> 128` block states).
|
|
83
|
+
- π **Negative Coordinate Axis Alignment**: Regions saved with negative selection bounds in Litematica are automatically normalized to WorldEdit's `(Y * Length + Z) * Width + X` index ordering.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## π§± Minecraft Version Compatibility & Scope
|
|
88
|
+
|
|
89
|
+
This converter supports **Minecraft 1.13+ schematics** (1.13 through 1.20, 1.21+, etc.).
|
|
90
|
+
|
|
91
|
+
### Why is 1.13 the Minimum Supported Version?
|
|
92
|
+
With Minecraft 1.13 (**"The Flattening"**), blocks transitioned from numeric IDs and metadata values (e.g., `35:14`) to string-based namespaced block states (e.g., `minecraft:red_wool`). Sponge V2 palettes rely strictly on string-based block states and do not support legacy 1.12.2 numeric IDs.
|
|
93
|
+
|
|
94
|
+
### How Newer Versions & Modded Blocks Work
|
|
95
|
+
Block IDs and block state properties (`block.id` and `block.properties`) are parsed dynamically from the input `.litematic` file alongside its `MinecraftDataVersion` tag, without a hardcoded block registry.
|
|
96
|
+
|
|
97
|
+
### Known Format Limitations
|
|
98
|
+
- **No Cross-Version Block ID Remapping**: The converter preserves the source schematic's `DataVersion` and block state strings as-is. Loading a 1.21 schematic on an older 1.16 server will not downgrade blocks that did not exist in 1.16.
|
|
99
|
+
- **Pending Ticks**: Litematica's `PendingBlockTicks` and `PendingFluidTicks` have no standard equivalent in WorldEdit's Sponge V2 importer and are skipped with an informational console notice when present.
|
|
100
|
+
- **Dimension Bounds**: Sponge V2 stores `Width`, `Height`, and `Length` as signed 16-bit `Short` integers, limiting each axis of the combined bounding box to a maximum of `32,767` blocks.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## π₯ Installation
|
|
105
|
+
|
|
106
|
+
Ensure you have **Python 3.8+** installed on your system.
|
|
107
|
+
|
|
108
|
+
### Option 1: Install from PyPI (Recommended)
|
|
109
|
+
```bash
|
|
110
|
+
pip install litematic-to-schematic
|
|
111
|
+
```
|
|
112
|
+
*(This automatically installs the `lithetic`, `litematic-to-schematic`, `litematic2schem`, and `litematic2schematic` CLI commands.)*
|
|
113
|
+
|
|
114
|
+
### Option 2: Install from Source
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/Ohualtex/litematic-to-schematic.git
|
|
117
|
+
cd litematic-to-schematic
|
|
118
|
+
pip install .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## π Usage
|
|
124
|
+
|
|
125
|
+
### 1. Command-Line Interface (CLI)
|
|
126
|
+
|
|
127
|
+
Using the shorthand `lithetic` command (or `litematic-to-schematic` / `litematic2schem` / `python convert.py`):
|
|
128
|
+
```bash
|
|
129
|
+
lithetic sample_structure.litematic
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Specify a custom output file path and multi-region overlap policy:
|
|
133
|
+
```bash
|
|
134
|
+
lithetic sample_structure.litematic -o my_building.schem --on-overlap keep-first
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Display help menu:
|
|
138
|
+
```bash
|
|
139
|
+
lithetic --help
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2. Windows Batch Script (`start.bat`)
|
|
143
|
+
|
|
144
|
+
1. Double-click `start.bat`.
|
|
145
|
+
2. Enter the name of your `.litematic` file when prompted (e.g., `house.litematic`).
|
|
146
|
+
3. Your `.schem` file will be generated in the same directory.
|
|
147
|
+
|
|
148
|
+
### 3. Running the Test Suite
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python -m unittest discover -s tests -v
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## π Project Structure
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
litematic-to-schematic/
|
|
160
|
+
βββ pyproject.toml # PEP 621 package configuration & CLI entry points
|
|
161
|
+
βββ requirements.txt # Runtime dependencies (litemapy, nbtlib)
|
|
162
|
+
βββ convert.py # Backward-compatible CLI/API wrapper script
|
|
163
|
+
βββ start.bat # Windows interactive batch launcher
|
|
164
|
+
βββ README.md # English documentation (default)
|
|
165
|
+
βββ README_TR.md # Turkish documentation
|
|
166
|
+
βββ LICENSE # MIT License
|
|
167
|
+
βββ src/
|
|
168
|
+
β βββ litematic_to_schematic/
|
|
169
|
+
β βββ __init__.py # Package version & public API exports
|
|
170
|
+
β βββ __main__.py # `python -m litematic_to_schematic` entry point
|
|
171
|
+
β βββ converter.py # Core Litematica -> Sponge V2 conversion engine
|
|
172
|
+
β βββ cli.py # Argparse command-line interface
|
|
173
|
+
βββ tests/
|
|
174
|
+
βββ test_converter.py # Unit & integration test matrix (T01-T14)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## π License
|
|
180
|
+
|
|
181
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## π€ Author
|
|
186
|
+
|
|
187
|
+
**Ohualtex**
|
|
188
|
+
- GitHub: [@Ohualtex](https://github.com/Ohualtex)
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# π οΈ Litematica to Schematic Converter
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
-brightgreen.svg)
|
|
8
|
+
|
|
9
|
+
> Read this document in another language:
|
|
10
|
+
> πΉπ· **[TΓΌrkΓ§e (Turkish)](README_TR.md)**
|
|
11
|
+
|
|
12
|
+
A fast, reliable Python CLI tool and library to convert Minecraft **Litematica** (`.litematic`) schematics directly into **WorldEdit / FastAsyncWorldEdit (FAWE)** compatible **Sponge V2** (`.schem`) format.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## π― Purpose
|
|
17
|
+
|
|
18
|
+
In Minecraft, schematic files created by the Fabric/Quilt-based **Litematica** mod (`.litematic`) cannot be loaded directly by **WorldEdit** or **FAWE** plugins running on Forge, NeoForge, Paper, or Spigot servers.
|
|
19
|
+
|
|
20
|
+
This tool parses Litematica files directly at the NBT level without launching a Minecraft client and converts them into standard Sponge V2 `.schem` files.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## β¨ Features
|
|
25
|
+
|
|
26
|
+
- π§© **Multi-Region Merging & Conflict Policies**: Automatically computes the global bounding box across all regions in a `.litematic` file, aligns relative region offsets, prevents air blocks from erasing solid blocks, and provides configurable conflict resolution (`--on-overlap overwrite|keep-first|error`).
|
|
27
|
+
- π¦ **Sponge V2 NBT Structure & Dynamic `DataVersion`**: Preserves the source schematic's `MinecraftDataVersion` (falling back to `2586` only if missing) and builds a Sponge V2 NBT tree (`Version: 2`).
|
|
28
|
+
- π§° **BlockEntities & Entities Preservation**: Transfers container inventories (chests, barrels, shulker boxes, signs) and entities (armor stands, item frames, paintings, minecarts) with global coordinate alignment, `TileX/Y/Z` recalculation, and `UUID`/`Id` sanitization.
|
|
29
|
+
- π§ **Modded & Vanilla Namespace Integrity**: Preserves custom mod namespaces (e.g., `create:brass_casing`, `ae2:controller[state=online]`) while automatically prefixing un-namespaced vanilla identifiers with `minecraft:`.
|
|
30
|
+
- π’ **LEB128 VarInt Byte Encoding**: Encodes block palette indices into signed 8-bit NBT `ByteArray` streams using dynamic LEB128 VarInt encoding, supporting palettes of any size (`> 128` block states).
|
|
31
|
+
- π **Negative Coordinate Axis Alignment**: Regions saved with negative selection bounds in Litematica are automatically normalized to WorldEdit's `(Y * Length + Z) * Width + X` index ordering.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## π§± Minecraft Version Compatibility & Scope
|
|
36
|
+
|
|
37
|
+
This converter supports **Minecraft 1.13+ schematics** (1.13 through 1.20, 1.21+, etc.).
|
|
38
|
+
|
|
39
|
+
### Why is 1.13 the Minimum Supported Version?
|
|
40
|
+
With Minecraft 1.13 (**"The Flattening"**), blocks transitioned from numeric IDs and metadata values (e.g., `35:14`) to string-based namespaced block states (e.g., `minecraft:red_wool`). Sponge V2 palettes rely strictly on string-based block states and do not support legacy 1.12.2 numeric IDs.
|
|
41
|
+
|
|
42
|
+
### How Newer Versions & Modded Blocks Work
|
|
43
|
+
Block IDs and block state properties (`block.id` and `block.properties`) are parsed dynamically from the input `.litematic` file alongside its `MinecraftDataVersion` tag, without a hardcoded block registry.
|
|
44
|
+
|
|
45
|
+
### Known Format Limitations
|
|
46
|
+
- **No Cross-Version Block ID Remapping**: The converter preserves the source schematic's `DataVersion` and block state strings as-is. Loading a 1.21 schematic on an older 1.16 server will not downgrade blocks that did not exist in 1.16.
|
|
47
|
+
- **Pending Ticks**: Litematica's `PendingBlockTicks` and `PendingFluidTicks` have no standard equivalent in WorldEdit's Sponge V2 importer and are skipped with an informational console notice when present.
|
|
48
|
+
- **Dimension Bounds**: Sponge V2 stores `Width`, `Height`, and `Length` as signed 16-bit `Short` integers, limiting each axis of the combined bounding box to a maximum of `32,767` blocks.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## π₯ Installation
|
|
53
|
+
|
|
54
|
+
Ensure you have **Python 3.8+** installed on your system.
|
|
55
|
+
|
|
56
|
+
### Option 1: Install from PyPI (Recommended)
|
|
57
|
+
```bash
|
|
58
|
+
pip install litematic-to-schematic
|
|
59
|
+
```
|
|
60
|
+
*(This automatically installs the `lithetic`, `litematic-to-schematic`, `litematic2schem`, and `litematic2schematic` CLI commands.)*
|
|
61
|
+
|
|
62
|
+
### Option 2: Install from Source
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/Ohualtex/litematic-to-schematic.git
|
|
65
|
+
cd litematic-to-schematic
|
|
66
|
+
pip install .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## π Usage
|
|
72
|
+
|
|
73
|
+
### 1. Command-Line Interface (CLI)
|
|
74
|
+
|
|
75
|
+
Using the shorthand `lithetic` command (or `litematic-to-schematic` / `litematic2schem` / `python convert.py`):
|
|
76
|
+
```bash
|
|
77
|
+
lithetic sample_structure.litematic
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Specify a custom output file path and multi-region overlap policy:
|
|
81
|
+
```bash
|
|
82
|
+
lithetic sample_structure.litematic -o my_building.schem --on-overlap keep-first
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Display help menu:
|
|
86
|
+
```bash
|
|
87
|
+
lithetic --help
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 2. Windows Batch Script (`start.bat`)
|
|
91
|
+
|
|
92
|
+
1. Double-click `start.bat`.
|
|
93
|
+
2. Enter the name of your `.litematic` file when prompted (e.g., `house.litematic`).
|
|
94
|
+
3. Your `.schem` file will be generated in the same directory.
|
|
95
|
+
|
|
96
|
+
### 3. Running the Test Suite
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python -m unittest discover -s tests -v
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## π Project Structure
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
litematic-to-schematic/
|
|
108
|
+
βββ pyproject.toml # PEP 621 package configuration & CLI entry points
|
|
109
|
+
βββ requirements.txt # Runtime dependencies (litemapy, nbtlib)
|
|
110
|
+
βββ convert.py # Backward-compatible CLI/API wrapper script
|
|
111
|
+
βββ start.bat # Windows interactive batch launcher
|
|
112
|
+
βββ README.md # English documentation (default)
|
|
113
|
+
βββ README_TR.md # Turkish documentation
|
|
114
|
+
βββ LICENSE # MIT License
|
|
115
|
+
βββ src/
|
|
116
|
+
β βββ litematic_to_schematic/
|
|
117
|
+
β βββ __init__.py # Package version & public API exports
|
|
118
|
+
β βββ __main__.py # `python -m litematic_to_schematic` entry point
|
|
119
|
+
β βββ converter.py # Core Litematica -> Sponge V2 conversion engine
|
|
120
|
+
β βββ cli.py # Argparse command-line interface
|
|
121
|
+
βββ tests/
|
|
122
|
+
βββ test_converter.py # Unit & integration test matrix (T01-T14)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## π License
|
|
128
|
+
|
|
129
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## π€ Author
|
|
134
|
+
|
|
135
|
+
**Ohualtex**
|
|
136
|
+
- GitHub: [@Ohualtex](https://github.com/Ohualtex)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "litematic-to-schematic"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Convert Minecraft Litematica (.litematic) schematics directly to WorldEdit Sponge V2 (.schem) format."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Ohualtex" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["minecraft", "litematica", "litematic", "schematic", "schem", "worldedit", "sponge", "lithetic"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: End Users/Desktop",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.8",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Topic :: Games/Entertainment",
|
|
30
|
+
"Topic :: Utilities",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
"litemapy",
|
|
34
|
+
"nbtlib",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/Ohualtex/litematic-to-schematic"
|
|
39
|
+
Repository = "https://github.com/Ohualtex/litematic-to-schematic"
|
|
40
|
+
Issues = "https://github.com/Ohualtex/litematic-to-schematic/issues"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
litematic-to-schematic = "litematic_to_schematic.cli:main"
|
|
44
|
+
litematic2schem = "litematic_to_schematic.cli:main"
|
|
45
|
+
litematic2schematic = "litematic_to_schematic.cli:main"
|
|
46
|
+
lithetic = "litematic_to_schematic.cli:main"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Litematica (.litematic) to WorldEdit Sponge V2 (.schem) converter package."""
|
|
2
|
+
|
|
3
|
+
from .converter import (
|
|
4
|
+
litematic_to_schem_final,
|
|
5
|
+
normalize_identifier,
|
|
6
|
+
format_block_state,
|
|
7
|
+
encode_varint,
|
|
8
|
+
decode_varint,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
__version__ = "1.0.0"
|
|
12
|
+
__all__ = [
|
|
13
|
+
"litematic_to_schem_final",
|
|
14
|
+
"normalize_identifier",
|
|
15
|
+
"format_block_state",
|
|
16
|
+
"encode_varint",
|
|
17
|
+
"decode_varint",
|
|
18
|
+
"__version__",
|
|
19
|
+
]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import argparse
|
|
4
|
+
from .converter import litematic_to_schem_final, VALID_OVERLAP_POLICIES
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
8
|
+
parser = argparse.ArgumentParser(
|
|
9
|
+
description="Converts Litematica files (.litematic) directly to WorldEdit Sponge V2 Schematic (.schem) format."
|
|
10
|
+
)
|
|
11
|
+
parser.add_argument("input", help="Path to the input .litematic file")
|
|
12
|
+
parser.add_argument("-o", "--output", help="Optional: Custom output .schem file path", default=None)
|
|
13
|
+
parser.add_argument(
|
|
14
|
+
"--on-overlap",
|
|
15
|
+
choices=VALID_OVERLAP_POLICIES,
|
|
16
|
+
default="overwrite",
|
|
17
|
+
help="Conflict resolution policy when multiple regions overlap with non-air blocks (default: overwrite)",
|
|
18
|
+
)
|
|
19
|
+
return parser
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main(argv=None) -> int:
|
|
23
|
+
parser = build_parser()
|
|
24
|
+
args = parser.parse_args(argv)
|
|
25
|
+
|
|
26
|
+
input_file = args.input
|
|
27
|
+
|
|
28
|
+
if args.output:
|
|
29
|
+
output_file = args.output
|
|
30
|
+
else:
|
|
31
|
+
# Strip extension and append .schem
|
|
32
|
+
base_name = os.path.splitext(input_file)[0]
|
|
33
|
+
output_file = f"{base_name}.schem"
|
|
34
|
+
|
|
35
|
+
success = litematic_to_schem_final(input_file, output_file, on_overlap=args.on_overlap)
|
|
36
|
+
if not success:
|
|
37
|
+
sys.exit(1)
|
|
38
|
+
return 0
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if __name__ == "__main__":
|
|
42
|
+
main()
|