Skip to content

Python API

Generated from Python signatures and docstrings by make docs.

Arguments after * are keyword-only. Types and properties are documented below.

Function inspect_schematics

Source

inspect_schematics(
    schematics: Sequence[Schematic],
    *,
    initial_items: Sequence[tuple[str, int]] = (),
) -> dict

Combines resource counts and inspection details for multiple schematics.

Args:

  • schematics: Schematics whose contents contribute to the totals.
  • initial_items: Item identifiers and counts to add to the stored item totals.

Returns: Combined counts and individual reports in placements. The complete flag is false when any report contains incomplete inspection diagnostics.

Schematic

Source

A versioned schematic containing named regions and metadata.

Obtain a schematic with create(), load(), or from_bytes(). Its region handles and selections edit the same schematic.

Schematic.create

Schematic.create(
    *,
    edition: str = 'java',
    version: str = 'latest',
    data: MinecraftData | None = None,
) -> Schematic

Creates an empty schematic with a main region and a loaded catalog.

Args:

  • edition: Minecraft edition; new authoring currently supports java.
  • version: Java version, or latest for the newest supported release.
  • data: Catalog provider; None uses the shared default provider.

Returns: A new Schematic.

Raises: ValueError: If the edition or version is unsupported or loading fails.

Schematic.load

Schematic.load(
    path: _Path,
    *,
    format: str | None = None,
    data: MinecraftData | None = None,
    version: str | None = None,
    origin: Position | None = None,
    palette: Mapping[str, Block] | None = None,
    max_unpacked_bytes: int | None = None,
) -> Schematic

Reads a schematic file, preserving its edition and Minecraft version.

Args:

  • path: Input file path.
  • format: Codec name; None infers it from the extension, with .wiki selecting blueprint.
  • data: Catalog provider; None uses the shared default provider.
  • version: Explicit Java version for blueprint import only.
  • origin: Schematic-global origin for blueprint import only.
  • palette: Blueprint symbols mapped to explicit Block descriptions.

Returns: A Schematic with any import notices in import_diagnostics.

Raises:

  • OSError: If the file cannot be read.
  • ValueError: If decoding fails or import options are unsupported.

Schematic.from_bytes

Schematic.from_bytes(
    content: bytes,
    *,
    format: str,
    data: MinecraftData | None = None,
    version: str | None = None,
    origin: Position | None = None,
    palette: Mapping[str, Block] | None = None,
    max_unpacked_bytes: int | None = None,
) -> Schematic

Decodes schematic bytes without changing their Minecraft version.

Args:

  • content: Encoded schematic, or UTF-8 text for snbt and blueprint.
  • format: schem (v3), schem2 (v2), litematic, nbt, snbt, mcstructure, or blueprint.
  • data: Catalog provider; None uses the shared default provider.
  • version: Explicit Java version required for blueprint import only.
  • origin: Schematic-global origin for blueprint import only; defaults to (0, 0, 0).
  • palette: Blueprint symbols mapped to explicit Block descriptions.

Returns: A Schematic with any import notices in import_diagnostics.

Raises: ValueError: If decoding fails or import options are unsupported.

Schematic.to_bytes

Schematic.to_bytes(
    *,
    format: str,
    version: str | None = None,
    allow_loss: bool = False,
    flatten: bool = False,
) -> bytes

Encodes the schematic, requiring explicit acceptance of reported losses.

Args:

  • format: schem (v3), schem2 (v2), litematic, nbt, snbt, mcstructure, or blueprint.
  • version: Target Minecraft Java version; None preserves the current version.
  • allow_loss: Whether to accept omissions reported by check_export(). Blocking errors still prevent export.
  • flatten: Whether to merge regions for a single-region format. Overlapping bounds are rejected, and loss of region boundaries is reported.

Returns: The encoded bytes.

Raises: ValueError: If export has blocking errors or unaccepted losses.

Schematic.save

Schematic.save(
    path: _Path,
    *,
    format: str | None = None,
    version: str | None = None,
    allow_loss: bool = False,
    flatten: bool = False,
) -> None

Encodes the schematic and atomically replaces the destination file.

Args:

  • path: Output file path.
  • format: Codec name; None infers it from the extension, with .wiki selecting blueprint.
  • version: Target Minecraft Java version; None preserves the current version.
  • allow_loss: Whether to accept reported data omissions. Blocking errors still prevent export.
  • flatten: Whether to merge regions for a single-region format.

Raises:

  • OSError: If the output file cannot be written.
  • ValueError: If export has blocking errors or unaccepted losses.

Schematic.region

Schematic.region(name: str = 'main') -> Region

Returns an editing handle for an existing named region.

Args: name: Region name.

Raises: ValueError: If the region does not exist.

Schematic.export_glb

Schematic.export_glb(
    path: _Path,
    *,
    region: str | None = None,
    x: AxisRange = None,
    y: AxisRange = None,
    z: AxisRange = None,
) -> tuple[str, ...]

Writes textured geometry to a binary glTF file.

Identical blocks and attached data at shared global positions render once. Palette states are converted once to 1.21.6 for rendering; stored blocks stay unchanged.

Args:

  • path: Output file path, replaced if it exists.
  • region: Region name; None selects all regions.
  • x: Global X coordinate or inclusive (minimum, maximum) pair; None keeps all.
  • y: Global Y coordinate or inclusive (minimum, maximum) pair; None keeps all.
  • z: Global Z coordinate or inclusive (minimum, maximum) pair; None keeps all.

Returns: Diagnostics describing visual approximations.

Raises: ValueError: If overlapping regions contain conflicting blocks or attached data.

Schematic.export_blueprint

Schematic.export_blueprint(
    path: _Path,
    *,
    name: str = 'Blueprint',
    region: str | None = None,
    y: AxisRange = None,
    rotation: int = 0,
    sprites: Mapping[str, str] | None = None,
) -> tuple[str, ...]

Writes Minecraft Wiki layered-blueprint markup using block sprites.

Args:

  • path: Output UTF-8 file path, replaced if it exists.
  • name: Blueprint title.
  • region: Region name; None selects all regions.
  • y: Global Y coordinate or inclusive pair; None keeps all layers.
  • rotation: Number of quarter turns about Y.
  • sprites: Block IDs or full state strings mapped to wiki sprite identifiers.

Returns: Diagnostics for state properties, attached data, and other omissions.

Schematic.export_sprites

Schematic.export_sprites(
    path: _Path,
    *,
    view: str = 'top',
    cell_size: int = 32,
    grid: bool = False,
    entities: bool = True,
    region: str | None = None,
    x: AxisRange = None,
    y: AxisRange = None,
    z: AxisRange = None,
    sprites: Mapping[str, str] | None = None,
) -> tuple[str, ...]

Writes a flat PNG diagram using bundled Minecraft Wiki sprites.

Args:

  • path: Output file path, replaced if it exists.
  • view: top, bottom, north, south, east, or west.
  • cell_size: Pixels per grid cell, from 1 through 128.
  • grid: Whether to draw grid lines.
  • entities: Whether to include free-entity icons.
  • region: Region name; None selects all regions.
  • x: Global X coordinate or inclusive pair; None keeps all.
  • y: Global Y coordinate or inclusive pair; None keeps all.
  • z: Global Z coordinate or inclusive pair; None keeps all.
  • sprites: Block IDs or full state strings mapped to wiki sprite identifiers.

Returns: Diagnostics describing omitted state details and sprite approximations.

Schematic.export_png

Schematic.export_png(
    path: _Path,
    *,
    size: tuple[int, int] | list[int] = (1024, 1024),
    view: str = 'isometric',
    grid: bool = False,
    threads: int = 8,
    region: str | None = None,
    x: AxisRange = None,
    y: AxisRange = None,
    z: AxisRange = None,
) -> tuple[str, ...]

Writes an automatically framed textured PNG with a transparent background.

Identical blocks and attached data at shared global positions render once. Palette states are converted once to 1.21.6 for rendering; stored blocks stay unchanged.

Args:

  • path: Output file path, replaced if it exists.
  • size: (width, height), each from 1 through 4096 pixels.
  • view: isometric, top, bottom, north, south, east, or west. Cardinal names describe the viewer's location; side views keep Y-up vertical.
  • grid: Whether to draw outlined block edges; entities are excluded.
  • threads: Maximum rasterizer worker threads; a positive integer, default 8.
  • region: Region name; None selects all regions.
  • x: Global X coordinate or inclusive pair; None keeps all.
  • y: Global Y coordinate or inclusive pair; None keeps all.
  • z: Global Z coordinate or inclusive pair; None keeps all.

Returns: Diagnostics describing visual approximations. Rendering uses the shared Java 1.21.6 visual bundle.

Raises: ValueError: If overlapping regions contain conflicting blocks or attached data.

Schematic.add_region

Schematic.add_region(name: str, *, origin: Position = (0, 0, 0)) -> Region

Adds an empty region and returns its editing handle.

Args:

  • name: Nonempty, unique region name.
  • origin: Region origin in schematic-global coordinates.

Raises: ValueError: If the name is empty or already exists.

Schematic.regions

Schematic.regions: tuple[str, ...]

The names of the schematic's regions.

Schematic.import_diagnostics

Schematic.import_diagnostics: tuple[str, ...]

Notices about assumptions or omissions made while importing.

Schematic.edition

Schematic.edition: str

The schematic's Minecraft edition.

Schematic.version

Schematic.version: str

The schematic's Minecraft version string.

Schematic.data_version

Schematic.data_version: int

The numeric Minecraft data version stored in the schematic.

Schematic.metadata

Schematic.metadata: str

Schematic metadata as typed SNBT; assigning replaces the whole compound.

Writable property.

Replaces schematic metadata with a typed SNBT compound.

Schematic.registry

Schematic.registry: Registry

Block schema access for the schematic's Minecraft version.

Schematic.inspect

Schematic.inspect() -> dict

Returns resource counts, inventories, payload details, and inspection diagnostics.

Returns: A dictionary whose complete flag is false when text could not be inspected.

Schematic.material_cost

Schematic.material_cost() -> dict

Returns fractional primitive-material costs for placed blocks without editing them.

Recipe costs are compiled once per catalog version and shared between schematics. Shaped crafting recipes take priority; other candidates retain catalog order. The first recipe that expands to declared primitives without a cycle is used. The built-in Java primitive policy defines gathering boundaries, including logs, minerals, natural blocks, drops, and plants. World-block primitives such as bedrock and portals count once per occupied block without requiring inventory items. Water and lava count only source blocks (level=0); flowing and falling fluids are excluded. Any block or item without a recipe expansion counts as one unit of itself. This does not find the cheapest recipe.

Doors, beds, and tall plants count once per pair; orphan halves count once. Double slabs and stacked candles, eggs, snow layers, and plants use item quantities. Wall-mounted variants resolve to their inventory items. Regions contribute their stored placements, including overlaps. Inventories and entities are excluded.

Returns: A dictionary containing items (placed item or primitive block counts) and raw_materials (fractional primitive quantities). Fuel, tool wear, fluid acquisition, and component-dependent recipes are outside this estimate. Filled-container primitives count gross inputs; returned empty containers are not credited.

Raises: ValueError: If the schematic is not Java, its catalog or recipes are unavailable, recipe data is invalid, or counts overflow.

Schematic.value_cost

Schematic.value_cost(profile: str) -> dict

Values primitive material quantities using a bundled price profile.

Calls material_cost() and sums primitive quantity times unit price. Missing prices contribute nothing and are returned with their primitive quantities. A price of zero is priced. No normalization or schematic editing is performed. Profiles are fixed snapshots shared across Minecraft versions.

Args: profile: emc for ProjectE-based values or essentialsx for server sell prices.

Returns: A dictionary containing total (the priced sum) and unpriced (primitive IDs and quantities missing a price). The total is partial when unpriced is nonempty.

Raises: ValueError: If the profile is unknown, prices are invalid, material costs cannot be computed, or the total overflows.

Schematic.normalize

Schematic.normalize(
    profile: _Path | None = None,
    *,
    keep: Sequence[str] = (),
    replace: Mapping[str, str] | None = None,
    fallback: str | None = None,
) -> dict

Normalizes all regions using inline rules and an optional profile.

Explicit keep wins over replace, which overrides profile keeps and replacements. An explicit fallback overrides the profile fallback. Without a fallback, unlisted blocks remain unchanged. Override targets remain canonical; chained mappings are skipped, so reapplying the same rules changes nothing. Profiles must match the schematic's edition; block IDs are checked against its version. Non-air replacements retain properties supported by the target, discard unsupported properties, and use target defaults for new properties. Shared property values must be valid for the target. Both blocks must use the same block-entity type, and compatible attached data is preserved unchanged. Attached-data IDs must match when present; an omitted ID uses the known owning block-entity type. Invalid or incompatible replacements are skipped silently.

Args:

  • profile: Optional bundled profile name (redstone), or a path to a UTF-8 JSON file with edition and optional keep, replacements, and fallback. keep is a list of block IDs; fallback is a block ID. Each replacement has a from list and a to block ID.
  • keep: Block IDs to preserve for this call, including all states and attached data.
  • replace: Mapping of source block IDs to target block IDs for this call. Invalid overrides leave their source blocks unchanged.
  • fallback: Block ID for remaining eligible blocks. None uses the profile's fallback, if any. A fallback that is itself replaced is skipped.

Returns: A dictionary with changed (total replaced blocks) and replacements (from, to, and count records, sorted by source block ID).

Raises:

  • OSError: If the profile file cannot be read.
  • ValueError: If the profile JSON is malformed, the edition differs, or the schematic has no catalog. No changes are committed.
  • TypeError: If keep is a string, replace is not a mapping, or block IDs are not strings.

Schematic.validate

Schematic.validate() -> Report

Checks Java game rules without changing the schematic or simulating ticks.

Returns: A Report with structural errors, unstable-state warnings, and unknown checks requiring surrounding blocks or unavailable game data.

Schematic.repair

Schematic.repair(*, rules: Sequence[str] | None = None) -> RepairReport

Repairs neighbor-dependent connections and shapes in place.

Uses the same expected-state calculations as validate(). All supported rules run by default. Neighbor lookups cross regions in schematic-global coordinates; known connections are repaired even when other sides are unknown. Properties requiring unknown surroundings remain unchanged. Isolated redstone dots remain dots. Power, facing, waterlogging, entities, and attached data are preserved. Loading never invokes repair automatically.

Args: rules: Any subset of redstone, stairs, fences, panes, and walls. None enables all rules; an empty sequence changes nothing.

Returns: A RepairReport containing before/after states and skipped reasons.

Raises:

  • ValueError: If a rule is unsupported, regions overlap, bounds are invalid, or repairs cannot converge. No changes are committed.
  • TypeError: If rules is a string rather than a sequence of rule names.

Schematic.check_export

Schematic.check_export(*, format: str, version: str | None = None, flatten: bool = False) -> Report

Checks conversion errors and losses without writing or changing the schematic.

Args:

  • format: Target codec name.
  • version: Target Minecraft Java version; None preserves the current version.
  • flatten: Whether to evaluate merging regions for a single-region format.

Returns: A Report whose errors block export and whose losses need allow_loss=True.

MinecraftData

Source

Shared access to pinned Java catalogs and cached rendering assets.

MinecraftData.init

MinecraftData(cache_dir: _Path | None = None, *, offline: bool = False) -> None

Creates a catalog provider without preloading catalogs or visuals.

Args:

  • cache_dir: Cache directory; None uses the platform default.
  • offline: Whether to require cached data and disable downloads.

MinecraftData.cache_dir

MinecraftData.cache_dir: Path

The resolved directory used for cached catalogs and rendering assets.

MinecraftData.versions

MinecraftData.versions: tuple[str, ...]

Available Java catalog versions at or above the 1.13 minimum.

MinecraftData.load

MinecraftData.load(version: str = 'latest') -> str

Loads a catalog and returns its resolved Java version string.

Args: version: Java version, or latest for the newest supported release.

Raises: ValueError: If the version is unsupported or its catalog cannot be loaded.

MinecraftData.prepare

MinecraftData.prepare(
    version: str = 'latest',
    *,
    target: str | None = None,
    visuals: bool = False,
) -> str

Prepares a Minecraft version for later offline use.

Args:

  • version: Java version, or latest for the newest supported release.
  • target: Optional explicit conversion target. Also prepares intermediate catalogs and biomes used by that conversion route.
  • visuals: Whether to also prepare textured rendering assets and the shared rendering catalog. Sprite diagrams do not need these assets.

Returns: The resolved Java version. Downloads use the configured cache directory.

Raises: ValueError: If required data is unavailable, invalid, or missing while offline. A fresh cache requires a network connection.

MinecraftData.dataset

MinecraftData.dataset(version: str, kind: str) -> JsonValue

Loads and caches a parsed catalog dataset for a Java version.

Args:

  • version: Java version, or latest for the newest supported release.
  • kind: blocks, items, entities, blockCollisionShapes, biomes, recipes, recipeDefinitions, or itemTags. A shared tracker stores official server-JAR recipes and maps them to the requested version's item IDs. recipeDefinitions preserves original JSON; itemTags contains resolved numeric item IDs. Optional datasets load on demand.

Returns: The dataset's JSON value.

Raises: ValueError: If the dataset is unavailable, uncached in offline mode, invalid, or its kind is unsupported. No other version is substituted.

MinecraftData.load_visuals

MinecraftData.load_visuals(version: str = 'latest') -> Path

Prepares rendering assets and returns their cache directory.

Loads the requested and shared rendering catalogs for offline rendering.

Args: version: Java version, or latest. All versions use the 1.21.6 visual bundle.

Raises: ValueError: If the version is unsupported or the assets cannot be prepared.

Region

Source

An editing handle for a named region within a schematic.

Cell coordinates are local to this region. Its origin locates those coordinates in schematic-global coordinates. Obtain a handle through Schematic.region() or add_region().

Region.bounds

Region.bounds: Bounds

The region's stored bounding box in local coordinates.

Region.origin

Region.origin: Position

The schematic-global coordinates corresponding to this region's local (0, 0, 0).

Region.to_global

Region.to_global(local: Position) -> Position

Converts a region-local position to schematic-global coordinates by adding the origin.

Args: local: Integer coordinates relative to this region's origin.

Raises: ValueError: If the result exceeds signed 32-bit coordinates.

Region.to_local

Region.to_local(global_position: Position) -> Position

Converts a schematic-global position to region-local coordinates by subtracting the origin.

Args: global_position: Integer coordinates in the schematic's shared coordinate space.

Raises: ValueError: If the result exceeds signed 32-bit coordinates.

Region.get

Region.get(at: Position) -> Block

Returns the block at a position in this region.

Args: at: Integer coordinates relative to the region's origin.

Returns: The block at the position, or air if the cell is absent.

Region.get_all

Region.get_all() -> dict[Position, Block]

Returns a snapshot of non-air blocks keyed by region-local coordinates.

Identical states share immutable Block objects. Changes to the returned dictionary do not edit the schematic. Block entities and entities are excluded.

Region.set

Region.set(at: Position, content: Block | Fragment) -> None

Writes a block or pastes a fragment, replacing destination cells.

Args:

  • at: Local cell coordinates; fragments are anchored at their minimum corner.
  • content: Block description or independent Fragment. Fragments require matching editions and versions and preserve unrelated entities.

Region.set_many

Region.set_many(
    placements: Mapping[Position, Block] | Iterable[tuple[Position, Block]],
) -> None

Validates and writes a batch of blocks atomically.

Args: placements: Mapping of local positions to Blocks, or an iterable of (local position, Block) pairs. Later writes to the same position take precedence. Omitted positions are unchanged; write air to clear cells.

Raises: ValueError: If a block, coordinate, or region-bound change is unsupported. No blocks are written when validation fails.

Region.delete

Region.delete() -> None

Clears blocks, attached data, and entities within this region's bounds.

The named region, origin, and bounds remain in the schematic.

Region.patch

Region.patch(at: Position, **properties: PropertyValue) -> None

Changes supplied properties of the block at a local cell position.

Args:

  • at: Local cell coordinates.
  • **properties: Minecraft properties to replace; other properties are preserved.

Region.select

Region.select(*, start: Position, size: Position) -> Selection

Returns a box selection that edits this region's current content.

Args:

  • start: Inclusive minimum local coordinates; negative values are allowed.
  • size: Nonnegative cell counts along X, Y, and Z. Upper bounds are exclusive.

Returns: A Selection including cells and entities within the box.

Region.place

Region.place(placement: _Placement, *, at: Position, replace: bool = False) -> None

Validates and commits a placement recipe atomically.

Args:

  • placement: Placement returned by bed(), door(), sign(), or chest().
  • at: Local anchor cell: the foot of a bed, lower half of a door, or the sign or chest block.
  • replace: Whether to overwrite non-air blocks at recipe targets.

Raises: ValueError: If the recipe is invalid for this version or targets are occupied with replace=False.

Region.scheduled_ticks

Region.scheduled_ticks: tuple[ScheduledTick, ...]

Scheduled block and fluid updates in local coordinates, ordered by tick order.

Region.entities

Region.entities: Entities

The manager for entities in this region.

Region.block_entities

Region.block_entities: BlockEntities

The manager for NBT attached to this region's blocks.

ScheduledTick

Source

A scheduled update retained from an imported Litematic region.

Attributes:

  • position: Region-local cell coordinates.
  • identifier: Namespaced block or fluid identifier.
  • fluid: Whether this update belongs to the fluid tick list.
  • delay: Delay in game ticks.
  • priority: Minecraft tick priority, from -3 through 3.
  • order: Ordering value within the scheduled updates.
ScheduledTick.position: Position
ScheduledTick.identifier: str
ScheduledTick.fluid: bool
ScheduledTick.delay: int
ScheduledTick.priority: int
ScheduledTick.order: int

Selection

Source

A set of region-local cells and entities that reads current content.

Filters resolve membership once. Transforms update this selection's coordinates; other selections retain theirs. Block filters exclude entities.

Selection.bounds

Selection.bounds: Bounds

The selection's local bounding box.

Selection.get_all

Selection.get_all() -> dict[Position, Block]

Returns current non-air blocks at selected region-local coordinates.

The dictionary is an independent snapshot, with identical states sharing immutable Block objects. Block entities and entities are excluded.

Selection.select

Selection.select(
    *,
    block: str | None = None,
    properties: Mapping[str, PropertyValue] | None = None,
) -> Selection

Returns a new selection filtered by current block IDs and properties.

Args:

  • block: Minecraft block identifier; None accepts any block ID.
  • properties: Required property values; None leaves properties unrestricted.

Returns: A selection with fixed cell membership and no entities.

Raises: ValueError: If neither a block ID nor a property filter is supplied.

Selection.fill

Selection.fill(value: Block) -> Selection

Fills selected cells with a block and returns self; entities are unchanged.

Selection.replace

Selection.replace(identifier: str, value: Block) -> Selection

Replaces selected blocks matching an identifier and returns self.

Args:

  • identifier: Minecraft block ID to match, regardless of properties.
  • value: Replacement block description.

Selection.patch

Selection.patch(**properties: PropertyValue) -> Selection

Changes supplied properties on selected blocks and returns self.

Args: **properties: Properties to replace; other properties and entities remain.

Selection.delete

Selection.delete() -> Selection

Clears selected blocks, attached data, and selected entities; returns self.

Selection.move

Selection.move(*, offset: Position, replace: bool = False) -> Selection

Moves selected content atomically, updates membership, and returns self.

Args:

  • offset: Local X, Y, and Z displacement.
  • replace: Whether to overwrite occupied targets outside the source selection.

Raises: ValueError: If a target is occupied with replace=False or movement is unsupported. Self-overlap is allowed; selected air clears targets.

Selection.rotate

Selection.rotate(
    *,
    axis: str = 'y',
    steps: int = 1,
    pivot: FloatPosition | None = None,
    replace: bool = False,
) -> Selection

Rotates content atomically, updates membership, and returns self.

Args:

  • axis: Rotation axis; currently only y is supported.
  • steps: Number of quarter turns. Positive steps turn north toward west.
  • pivot: Local coordinates; None uses the bounding box's geometric center.
  • replace: Whether to overwrite occupied targets outside the source selection.

Raises: ValueError: If cells end off-grid, a target is occupied with replace=False, or block states or attached data cannot be transformed.

Selection.flip

Selection.flip(*, axis: str, center: float | None = None, replace: bool = False) -> Selection

Reflects content atomically, updates membership, and returns self.

Args:

  • axis: Reflection axis, x or z.
  • center: Local plane coordinate; None uses the bounding box's center.
  • replace: Whether to overwrite occupied targets outside the source selection.

Raises: ValueError: If cells end off-grid, a target is occupied with replace=False, or block states or attached data cannot be transformed.

Selection.duplicate

Selection.duplicate(*, offset: Position, replace: bool = False) -> Selection

Copies content at an offset and returns a new destination selection.

Args:

  • offset: Local X, Y, and Z displacement.
  • replace: Whether to overwrite occupied targets. Selected air clears targets.

Returns: The copied selection. The source selection retains its coordinates; copied entities receive new references.

Selection.copy

Selection.copy() -> Fragment

Returns an independent fragment anchored at the selection's minimum corner.

Selected air and attached data are included; unselected cells are omitted.

Raises: ValueError: If retained format data prevents copying the region.

Selection.counts

Selection.counts() -> dict[str, int]

Returns counts by full block-state string, excluding all air block types.

Selection.describe_layer

Selection.describe_layer(*, y: int) -> str

Returns a local Y layer as a text grid followed by a block-state legend.

Args: y: Local Y coordinate. Z increases down the grid; . means air and - means unselected. An empty layer returns a descriptive message.

Raises: ValueError: If the selection's X/Z area exceeds 65,536 cells.

Block

Source

Immutable block description.

Use block() to normalize an identifier and its properties.

Attributes:

  • id: Namespaced Minecraft block identifier.
  • properties: Read-only Minecraft property names and values.
Block.id: str

Block.properties

Block.properties: Mapping[str, str]

The read-only mapping of Minecraft property names to string values.

Block.str

Block.__str__() -> str

Returns the full block-state string with properties in sorted order.

Bounds

Source

A box with an inclusive start and exclusive upper bounds.

Attributes:

  • start: Minimum local cell coordinates.
  • size: Cell counts along X, Y, and Z.
Bounds.start: Position
Bounds.size: Position

Fragment

Source

An independent copy of selected cells, attached data, and entities.

Obtain one through Selection.copy() and paste it with Region.set(). Pasting requires matching Minecraft editions and versions.

Fragment.size

Fragment.size: Position

Cell counts along X, Y, and Z in the copied bounding box.

Report

Source

Issues found during game-rule validation or export preflight.

Attributes:

  • errors: Problems that prevent validation or export.
  • losses: Data omissions requiring explicit acceptance for export.
  • warnings: Unstable states or other advisory messages.
  • unknown: Checks that lack surrounding blocks or required game data.
Report.errors: tuple[str, ...]
Report.losses: tuple[str, ...]
Report.warnings: tuple[str, ...]
Report.unknown: tuple[str, ...]

Report.issues

Report.issues: tuple[str, ...]

All messages in error, loss, warning, then unknown order.

Report.ok

Report.ok: bool

Whether errors, losses, and unknown results are absent; warnings are allowed.

Report.str

Report.__str__() -> str

Returns labeled issues, or "No issues found." for an empty report.

RepairChange

Source

A repaired block, identified by region and local position.

Attributes:

  • region: Name of the containing region.
  • position: Region-local cell coordinates.
  • before: Block state before repair.
  • after: Block state after repair.
RepairChange.region: str
RepairChange.position: Position
RepairChange.before: Block
RepairChange.after: Block

RepairReport

Source

Changes applied by repair and cases skipped because their context is unknown.

Attributes:

  • changes: Immutable snapshots of changed blocks.
  • skipped: Reasons why individual properties could not be repaired.
RepairReport.changes: tuple[RepairChange, ...]
RepairReport.skipped: tuple[str, ...]

RepairReport.changed

RepairReport.changed: int

The number of blocks changed.

Function block

Source

block(identifier: str, **properties: PropertyValue) -> Block

Creates a block description, adding the minecraft namespace if omitted.

Args:

  • identifier: Minecraft block identifier.
  • **properties: Minecraft properties as strings, integers, or booleans.

Returns: An immutable Block. Catalog validation occurs when it is placed.

Function water_source

Source

water_source() -> Block

Returns a water block with level=0.

Function bed

Source

bed(*, color: str = 'red', head_toward: str = 'north') -> Placement

Creates a bed placement anchored at the foot block when placed.

Args:

  • color: Minecraft bed color.
  • head_toward: Direction from the foot to the head: north, south, east, or west.

Returns: A two-block placement for Region.place. Validated when placed.

Function door

Source

door(
    *,
    material: str = 'oak',
    facing: str = 'north',
    hinge: str = 'left',
    open: bool = False,
    powered: bool = False,
) -> Placement

Creates a door placement anchored at the lower block when placed.

Args:

  • material: Minecraft door material, such as oak or iron.
  • facing: Horizontal facing direction.
  • hinge: Hinge side, left or right.
  • open: Whether the door is open.
  • powered: Whether the door is powered.

Returns: A two-block placement for Region.place. Validated when placed.

Function sign

Source

sign(
    lines: Sequence[str],
    *,
    material: str = 'oak',
    rotation: int = 0,
    color: str = 'black',
) -> Placement

Creates a standing-sign placement with plain text on its front face.

Args:

  • lines: Up to four text lines; omitted lines are blank.
  • material: Minecraft sign material, such as oak.
  • rotation: Minecraft rotation value, 0 through 15.
  • color: Minecraft text color.

Returns: A placement for Region.place, with text encoded for the target version.

Function chest

Source

chest(
    *,
    facing: str = 'north',
    items: Mapping[int, _Item] | None = None,
) -> Placement

Creates a single-chest placement with optional inventory contents.

Args:

  • facing: Horizontal facing direction.
  • items: Slots 0 through 26 mapped to item() values; None leaves it empty.

Returns: A placement for Region.place. Items and states are validated when placed.

Function item

Source

item(identifier: str, *, count: int = 1, components: str | None = None) -> _Item

Creates an inventory item value for chest().

Args:

  • identifier: Minecraft item identifier.
  • count: Item count, from 1 through 99 when placed.
  • components: Optional typed SNBT compound; requires Java 1.20.5 or newer.

Returns: An (identifier, count, components) tuple, validated on chest placement.

Function mob

Source

mob(identifier: str, *, persistent: bool = True, nbt: str | None = None) -> _Mob

Creates a free-entity description for Region.entities.add().

Args:

  • identifier: Living-mob identifier supported by the target catalog.
  • persistent: Whether to set the entity's PersistenceRequired flag.
  • nbt: Optional typed SNBT compound; id and persistence are set from the supplied arguments when the entity is added.

Returns: An entity description, validated against the target catalog when added.

Registry

Source

Block schemas for a schematic's version, obtained through its registry.

Registry.describe

Registry.describe(identifier: str) -> dict[str, JsonValue]

Returns a block schema for this schematic's Minecraft version.

Args: identifier: Minecraft block identifier, with an optional namespace.

Returns: A dictionary with id, properties, version, and numeric_id.

Raises: ValueError: If the block is unknown or the schematic has no catalog.

Entity

Source

An immutable snapshot of an entity returned by Entities.get().

Attributes:

  • reference: Schematic-local integer used to address the stored entity.
  • position: Floating-point coordinates local to its region.
  • nbt: The entity's full typed SNBT compound.
Entity.reference: int
Entity.position: FloatPosition
Entity.nbt: str

Entities

Source

Access to a region's entities through schematic-local integer references.

Entities.add

Entities.add(value: _Mob, *, at: FloatPosition) -> int

Adds an entity and returns its schematic-local reference.

Args:

  • value: Entity description returned by mob().
  • at: Floating-point coordinates local to the region.

Entities.get

Entities.get(reference: int) -> Entity

Returns an immutable snapshot of the entity with the given reference.

Args: reference: Schematic-local reference of an entity in this region.

Raises: ValueError: If the reference does not identify an entity in this region.

Entities.update

Entities.update(
    reference: int,
    *,
    position: FloatPosition | None = None,
    nbt: str | None = None,
) -> None

Replaces supplied fields of an entity; omitted fields are preserved.

Args:

  • reference: Schematic-local reference of an entity in this region.
  • position: New floating-point local coordinates; None preserves the position.
  • nbt: Full typed SNBT compound including id; None preserves attached data.

Entities.remove

Entities.remove(reference: int) -> None

Removes the entity identified by a schematic-local reference.

Args: reference: Schematic-local reference of an entity in this region.

Raises: ValueError: If the reference does not identify an entity in this region.

Entities.iter

Entities.__iter__() -> Iterator[int]

Iterates a snapshot of this region's entity references.

Yields: Schematic-local integer references accepted by this manager.

BlockEntities

Source

Access to typed NBT attached to blocks at region-local cell coordinates.

BlockEntities.get

BlockEntities.get(at: Position) -> str | None

Returns typed SNBT at a local cell position, or None if no data is attached.

BlockEntities.set

BlockEntities.set(at: Position, nbt: str) -> None

Replaces the NBT attached to a block at a local cell position.

Args:

  • at: Local coordinates of the owning block.
  • nbt: Full typed SNBT compound with an id compatible with that block.

Raises: ValueError: If parsing fails or id is missing or incompatible.

BlockEntities.remove

BlockEntities.remove(at: Position) -> None

Removes attached NBT at a local cell position; the owning block remains.

Type aliases

Position = tuple[int, int, int]
FloatPosition = tuple[float, float, float]
PropertyValue = str | int | bool
AxisRange = int | tuple[int, int] | list[int] | None
JsonValue = bool | int | float | str | list['JsonValue'] | dict[str, 'JsonValue'] | None
_Path = str | PathLike[str]
_Item = tuple[str, int, str | None]

Placement (_Placement in facade annotations) is the opaque recipe returned by bed, door, chest, and sign. _Mob is the entity description returned by mob.