Converts Java .nbt files to Bedrock .mcstructure files
This program is a port of Structure Editor originally made by MCBE Essentials in Python 3.
The reason this program is built in Python is because:
- JavaScript has a limit on the size of what
Buffer
and array can allocate in the engine unlike Python. - Structure templates generated in their structure editor does not work in Minecraft, because Minecraft requires the
"block_indices"
field's arrays need to both be the same size.
-
Install required dependencies via:
pip install -r requirements.txt
-
To convert
.nbt
files to.mcstructure
, put your Java nbt files in thestructures
folder. -
Run
__main__.py
, the program converts all java structures in thestructures
folder to the bedrock structure format, and they should be generated instructures
folder.
This converter is available as a Regolith filter as well.
The filter allows you to place your .nbt
structure files straight into the packs/BP/structures
folder which will be compiled into the .mcstructure
format.
The filter:
- Converts
.nbt
structure files into.mcstructure
format. - Removes the original
.nbt
files in the compiled version to keep your project clean.
Add the following to your Regolith filter definitions to enable the filter:
"nbt-to-mcstructure": {"url": "github.com/JaylyDev/nbt-to-mcstructure", "version": "HEAD"}
Once installed, the filter generates a settings.json
file located in data/nbt-to-mcstructure/
. This file allows you to customize block mapping, either by using vanilla overwrites or defining a custom namespace.
{
"block_mapping": [
{
"structure_id": "add_your_structure_id_here", // Matches your file name (excluding the file suffix).
"mapping": {
"minecraft:dirt": "namespace:custom_dirt",
"minecraft:stone": "namespace:custom_stone"
}
},
{
"structure_id": "add_another_structure_id_here",
"mapping": {
"minecraft:diamond_block": "namespace:custom_diamond_block",
"minecraft:iron_ore": "namespace:custom_iron_ore"
}
}
]
}
Block mapping supports wildcards to simplify configurations. For example, instead of specifying mappings for each structure individually:
{
"block_mapping": [
{"structure_id": "oak_extra_small_1", "mapping": {"minecraft:oak_log": "namespace:custom_oak_log"}},
{"structure_id": "oak_extra_small_2", "mapping": {"minecraft:oak_log": "namespace:custom_oak_log"}},
{"structure_id": "oak_extra_small_3", "mapping": {"minecraft:oak_log": "namespace:custom_oak_log"}},
{"structure_id": "oak_extra_small_4", "mapping": {"minecraft:oak_log": "namespace:custom_oak_log"}},
{"structure_id": "oak_extra_small_5", "mapping": {"minecraft:oak_log": "namespace:custom_oak_log"}}
]
}
You can use a wildcard to reduce redundancy:
{
"block_mapping": [
{
"structure_id": "oak_extra_small_*",
"mapping": {
"minecraft:oak_log": "namespace:custom_oak_log"
}
}
]
}
This approach saves space and simplifies configurations for large projects involving multiple similar structures, such as trees, houses, or castles.
We welcome contributions to keep this converter up-to-date and efficient. For inquiries or to collaborate:
- JaylyDev: Contact regarding the core program.
- ThijsHankelMC: Contact regarding the Regolith Filter.
Discord IDs:
- jaylymc
- thijsmc