Skip to main content

NBT Structure Utils

A python library to create and edit NBT structure files for Minecraft.

This has been tested with Minecraft Java, version 1.19.3.

Features

  • Create, read, and edit NBT structure files.
  • Methods inspired by Minecraft's fill, setblock, and clone commands.
  • Edit the state, inventory, and NBT data of blocks.
  • Special classes to help fill Cuboids and draw straight lines.

Basic Usage

See class docstrings for finer details and lists of methods.

Minecraft NBT Structure

This library creates .nbt files that can be placed in minecraft worlds. with a Structure Block or structure command.

See the minecraft wiki for details on each:

Edit blocks

Basic Example: create a 5x5x5 cube of stone and save to file:

from nbt_structure_utils import NBTStructure, Vector, Cuboid, BlockData
nbtstructure = NBTStructure()
c1, c2 = Vector(0, 0, 0), Vector(4, 4, 4)
nbtstructure.fill(Cuboid(c1, c2), BlockData("stone"))
nbtstructure.get_nbt().write_file(filename="path/to/output/hollow_box.nbt")

Read and Edit

You can load and edit NBT structures created by this library or by Minecraft. All or part of a structure can also be cloned into other structures.

Example: Load from disk and mirror the structure to be upside down:

from nbt_structure_utils import NBTStructure, Vector
nbtstructure = NBTStructure("path/to/existing_structure.nbt")
nbtstructure.reflect(Vector(None,0,None))
nbtstructure.get_nbt().write_file(filename="path/to/output/structure_flipped.nbt")

Edit inventories

Create an Inventory and save it to desired blocks.

Example: Create a dropper with an enchanted wooden sword in the 5th slot:

from nbt_structure_utils import NBTStructure, Vector, BlockData, Inventory, Enchantment
structure = NBTStructure()
inv_block_info = BlockData("dropper",[("facing","up")])
enchants = [Enchantment("sweeping", 3)]
inv = Inventory([ItemStack("wooden_sword", 1, 4, 0, enchants, None)])
structure.set_block(Vector(0, 0, 0), inv_block_info, inv, None)
nbtstructure.get_nbt().write_file(filename="path/to/output/sword_dropper.nbt")

Metadata

Release files for nbt-structure-utils 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nbt-structure-utils 0.3.0
File Size Uploaded
nbt_structure_utils-0.3.0.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nbt-structure-utils 0.3.0
File Interpreter ABI Platform
nbt_structure_utils-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.6 kB

Release files / nbt_structure_utils-0.3.0.tar.gz

Download URL nbt_structure_utils-0.3.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
93dea88949affe83529904f9fa521a67bf551155dc3ce3b4106991a83cdbc0cd
BLAKE2b-256 checksum
How to use checksums
e832217be61362bbaace20f6c61a3cffab74b4c09daff773d98b64c1c7009bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1036-azure

Release files / nbt_structure_utils-0.3.0-py3-none-any.whl

Download URL nbt_structure_utils-0.3.0-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43912838c1a1dde9ee68eaa3a9c49058ed65408f800197563686995c0efdebff
BLAKE2b-256 checksum
How to use checksums
715e59e3bec47479c7043a45cf3971c26ad12a7e3f7542e0d2f024aba6bd239e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1036-azure

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page