### Install MCSchematic Package Source: https://github.com/sloimayyy/mcschematic/blob/main/README.md The installation command for the mcschematic library using pip. ```shell pip install mcschematic ``` -------------------------------- ### Performing Structure Transformations Source: https://github.com/sloimayyy/mcschematic/blob/main/README.md Examples of using MCStructure transformation methods to manipulate the geometry of a schematic in-place. ```javascript const structure = schematic.getStructure(); structure.translate([10, 0, 10]); structure.rotateDegrees([0, 0, 0], 90, 0, 0); ``` -------------------------------- ### Extract Sub-Region with MCSchematic.getSubSchematic Source: https://context7.com/sloimayyy/mcschematic/llms.txt Demonstrates how to extract a specific portion of a schematic using `getSubSchematic` by defining two corner coordinates. The example also shows how to optionally recenter the extracted sub-region around the origin (0, 0, 0). ```python import mcschematic big_schem = mcschematic.MCSchematic() for x in range(20): for y in range(10): for z in range(20): if (x + y + z) % 3 == 0: big_schem.setBlock((x, y, z), "minecraft:stone") sub = big_schem.getSubSchematic((5, 2, 5), (10, 7, 10)) sub.save("", "extracted_region", mcschematic.Version.JE_1_20_4) sub_centered = big_schem.getSubSchematic((5, 2, 5), (10, 7, 10), reCenter=True) sub_centered.save("", "extracted_centered", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### Get Structure for Transformations with MCSchematic.getStructure Source: https://context7.com/sloimayyy/mcschematic/llms.txt Explains how to retrieve the underlying MCStructure object from an MCSchematic instance using `getStructure`. This allows for direct manipulation and transformations like rotation, translation, and scaling on the structure. ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:oak_stairs[facing=east]") schem.setBlock((1, 0, 0), "minecraft:oak_stairs[facing=east]") schem.setBlock((2, 0, 0), "minecraft:oak_stairs[facing=east]") structure = schem.getStructure() structure.rotateDegrees((0, 0, 0), yaw=90) print(schem.getBlockStateAt((0, 0, 0))) schem.save("", "rotated_stairs", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### Get Structure Bounds and Dimensions (Python) Source: https://context7.com/sloimayyy/mcschematic/llms.txt Computes the bounding box corners and dimensions of a structure. These operations can be computationally expensive, so caching results is recommended for large structures. It takes a structure object as input and returns tuples representing minimum and maximum corners, and dimensions (width, height, length). ```Python import mcschematic schem = mcschematic.MCSchematic() for i in range(100): schem.setBlock((i, i % 10, i % 20), "minecraft:stone") structure = schem.getStructure() # Get bounding box corners (minXYZ, maxXYZ) bounds = structure.getBounds() min_corner, max_corner = bounds print(f"Min corner: {min_corner}") # (0, 0, 0) print(f"Max corner: {max_corner}") # (99, 9, 19) # Get dimensions (width, height, length) dimensions = mcschematic.MCStructure.getStructureDimensions(bounds) print(f"Dimensions: {dimensions}") # (100, 10, 20) ``` -------------------------------- ### GET /getBlockStateAt Source: https://context7.com/sloimayyy/mcschematic/llms.txt Retrieves the block state string at a specific position, excluding NBT data for block entities. ```APIDOC ## GET /getBlockStateAt ### Description Returns the block state string at the specified position. Returns 'minecraft:air' if empty. ### Parameters #### Query Parameters - **coordinates** (tuple) - Required - (x, y, z) position to query. ### Response #### Success Response (200) - **state** (str) - The block state string. ``` -------------------------------- ### Initialize MCSchematic Object Source: https://context7.com/sloimayyy/mcschematic/llms.txt Demonstrates how to instantiate an MCSchematic object from scratch, load an existing file, or convert an MCStructure object. ```python import mcschematic # Create a new empty schematic schem = mcschematic.MCSchematic() # Load an existing schematic file schem = mcschematic.MCSchematic("path/to/existing_schematic.schem") # Create schematic from an existing MCStructure structure = mcschematic.MCStructure() structure.setBlock((0, 0, 0), "minecraft:diamond_block") schem = mcschematic.MCSchematic(structure) ``` -------------------------------- ### Create and Save Schematics with MCSchematic Source: https://context7.com/sloimayyy/mcschematic/llms.txt Demonstrates how to create walls for a simple house and save the schematic. It shows saving for specific Minecraft versions and using fast saving options. The code also illustrates saving to the current directory. ```python for y in range(1, 4): for x in range(5): schem.setBlock((x, y, 0), "minecraft:oak_planks") schem.setBlock((x, y, 4), "minecraft:oak_planks") for z in range(5): schem.setBlock((0, y, z), "minecraft:oak_planks") schem.setBlock((4, y, z), "minecraft:oak_planks") schem.save("output_folder", "simple_house", mcschematic.Version.JE_1_20_4) schem.save("output_folder", "simple_house_fast", mcschematic.Version.JE_1_18_2, fastSaving=True) schem.save("", "my_schematic", mcschematic.Version.JE_1_21) ``` -------------------------------- ### Place Schematic using MCSchematic.placeSchematic Source: https://context7.com/sloimayyy/mcschematic/llms.txt Shows how to create a small tower schematic and then place multiple instances of this tower into a main schematic at different positions. This is useful for creating repeating patterns or combining modular designs. ```python import mcschematic tower = mcschematic.MCSchematic() for y in range(4): tower.setBlock((0, y, 0), "minecraft:stone_bricks") tower.setBlock((1, y, 0), "minecraft:stone_bricks") tower.setBlock((0, y, 1), "minecraft:stone_bricks") tower.setBlock((1, y, 1), "minecraft:stone_bricks") main = mcschematic.MCSchematic() main.placeSchematic(tower, (0, 0, 0)) main.placeSchematic(tower, (10, 0, 0)) main.placeSchematic(tower, (0, 0, 10)) main.placeSchematic(tower, (10, 0, 10)) main.save("", "four_towers", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### Create and Save a Minecraft Schematic Source: https://github.com/sloimayyy/mcschematic/blob/main/README.md Demonstrates the full workflow of creating a new schematic, placing a stone block at relative coordinates, and saving the file to the local filesystem. ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, -1, 0), "minecraft:stone") schem.save("myschems", "my_cool_schematic", mcschematic.Version.JE_1_18_2) ``` -------------------------------- ### Place Blocks with MCSchematic.setBlock Source: https://context7.com/sloimayyy/mcschematic/llms.txt Shows how to place blocks using Minecraft's blockData string format, including support for block states and NBT data for complex entities. ```python import mcschematic schem = mcschematic.MCSchematic() # Place a simple block schem.setBlock((0, 0, 0), "minecraft:stone") # Place a block with state properties schem.setBlock((1, 0, 0), "minecraft:oak_stairs[facing=east,half=bottom,shape=straight]") # Place a block with axis property schem.setBlock((2, 0, 0), "minecraft:oak_log[axis=z]") # Place a chest with items (block entity with NBT) schem.setBlock((3, 0, 0), 'minecraft:chest[facing=north]{Items:[{Count:64b,Slot:0b,id:"minecraft:diamond"}]}') # Place a sign with custom text schem.setBlock((4, 0, 0), 'minecraft:oak_sign[rotation=8]{Text1:\'{"text":"Hello"}\'}') # Coordinates are relative - negative Y places blocks below the paste point schem.setBlock((0, -1, 0), "minecraft:bedrock") ``` -------------------------------- ### Utilize BlockDataDB for Container Signal Strengths (Python) Source: https://context7.com/sloimayyy/mcschematic/llms.txt Provides a static database class with pre-configured block data strings for containers, allowing specific comparator signal strengths (0-15). This is useful for redstone engineers needing precise signal outputs. It offers class constants for common strengths and a `fromSS` method for dynamic signal strength setting. ```Python import mcschematic schem = mcschematic.MCSchematic() # Place barrels with specific signal strengths using class constants schem.setBlock((0, 0, 0), mcschematic.BlockDataDB.SS_BARREL0) # Signal strength 0 schem.setBlock((1, 0, 0), mcschematic.BlockDataDB.SS_BARREL8) # Signal strength 8 schem.setBlock((2, 0, 0), mcschematic.BlockDataDB.SS_BARREL15) # Signal strength 15 # Or use the fromSS method for dynamic signal strength for i in range(16): schem.setBlock((i, 1, 0), mcschematic.BlockDataDB.BARREL.fromSS(i)) schem.setBlock((i, 2, 0), mcschematic.BlockDataDB.HOPPER.fromSS(i)) schem.setBlock((i, 3, 0), mcschematic.BlockDataDB.CHEST.fromSS(i)) # Available container types: # BARREL, HOPPER, FURNACE, DISPENSER, DROPPER, # TRAPPED_CHEST, CHEST, SHULKER_BOX, SMOKER, BLAST_FURNACE schem.save("", "signal_strength_demo", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### POST /save Source: https://context7.com/sloimayyy/mcschematic/llms.txt Saves the current schematic object to a .schem file on the local filesystem. ```APIDOC ## POST /save ### Description Serializes the schematic object and saves it to the specified path. ### Parameters #### Request Body - **folder** (str) - Required - Destination directory. - **name** (str) - Required - Filename without extension. - **version** (str) - Required - Target Minecraft version. - **fastSaving** (bool) - Optional - If true, uses a faster, less compressed algorithm. ``` -------------------------------- ### MCSchematic Constructor Source: https://context7.com/sloimayyy/mcschematic/llms.txt Initializes a new MCSchematic object, either as an empty structure, loaded from a file, or converted from an existing MCStructure. ```APIDOC ## Constructor MCSchematic() ### Description Creates a new schematic object. Can be initialized empty, from a file path, or an MCStructure object. ### Parameters #### Path Parameters - **source** (str/MCStructure) - Optional - Path to a .schem file or an existing MCStructure instance. ### Request Example # Create empty schem = mcschematic.MCSchematic() # Load from file schem = mcschematic.MCSchematic("path/to/file.schem") ``` -------------------------------- ### Accessing Container BlockData Source: https://github.com/sloimayyy/mcschematic/blob/main/README.md Demonstrates how to retrieve specific block data for containers with a defined signal strength using the BlockDataDB utility. ```javascript const blockData = mcschematic.BlockDataDB.CHEST.fromSS(15); ``` -------------------------------- ### Create Deep Copy with MCSchematic.makeCopy Source: https://context7.com/sloimayyy/mcschematic/llms.txt Illustrates the use of the `makeCopy` method to create an independent duplicate of a schematic. Modifications made to the copied schematic do not affect the original, ensuring data integrity when working with multiple versions or states. ```python import mcschematic original = mcschematic.MCSchematic() original.setBlock((0, 0, 0), "minecraft:diamond_block") copy = original.makeCopy() copy.setBlock((0, 0, 0), "minecraft:gold_block") copy.setBlock((1, 0, 0), "minecraft:iron_block") print(original.getBlockStateAt((0, 0, 0))) print(copy.getBlockStateAt((0, 0, 0))) ``` -------------------------------- ### MCSchematic Save Operations Source: https://context7.com/sloimayyy/mcschematic/llms.txt Demonstrates different ways to save a schematic with specified versions and options like fast saving. ```APIDOC ## MCSchematic Save Operations ### Description Demonstrates various methods for saving a schematic to a file, including specifying Minecraft versions and enabling fast saving. ### Method `schem.save(folder, name, version, fastSaving=False)` ### Parameters - **folder** (string) - Required - The directory to save the schematic in. An empty string saves to the current directory. - **name** (string) - Required - The base name for the schematic file. - **version** (mcschematic.Version) - Required - The Minecraft version to save for. - **fastSaving** (boolean) - Optional - If True, uses a faster saving method which may result in a larger file size. ### Request Example ```python import mcschematic # Example schematic creation (replace with actual schematic object) schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:oak_planks") # Save for Minecraft 1.20.4 schem.save("output_folder", "simple_house", mcschematic.Version.JE_1_20_4) # Save with fast saving (larger file, faster save) schem.save("output_folder", "simple_house_fast", mcschematic.Version.JE_1_18_2, fastSaving=True) # Save to current directory (empty string) schem.save("", "my_schematic", mcschematic.Version.JE_1_21) ``` ``` -------------------------------- ### Translate Structure with MCStructure.translate Source: https://context7.com/sloimayyy/mcschematic/llms.txt Demonstrates how to move all blocks within a structure by a specified offset vector using the `translate` method. This transformation is applied in-place and can be chained with other transformations. ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:diamond_block") schem.setBlock((1, 0, 0), "minecraft:gold_block") structure = schem.getStructure() structure.translate((10, 5, 10)) print(schem.getBlockStateAt((0, 0, 0))) print(schem.getBlockStateAt((10, 5, 10))) print(schem.getBlockStateAt((11, 5, 10))) schem.save("", "translated", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### MCSchematic.makeCopy Source: https://context7.com/sloimayyy/mcschematic/llms.txt Creates a deep copy of the schematic, ensuring modifications to the copy do not affect the original. ```APIDOC ## MCSchematic.makeCopy ### Description Creates a deep copy of the schematic with independent internal data. Modifications to the copy will not affect the original schematic. ### Method `original_schematic.makeCopy()` ### Parameters None ### Request Example ```python import mcschematic # Create original schematic original = mcschematic.MCSchematic() original.setBlock((0, 0, 0), "minecraft:diamond_block") # Make a copy copy = original.makeCopy() # Modify the copy without affecting original copy.setBlock((0, 0, 0), "minecraft:gold_block") copy.setBlock((1, 0, 0), "minecraft:iron_block") print(original.getBlockStateAt((0, 0, 0))) # Output: minecraft:diamond_block print(copy.getBlockStateAt((0, 0, 0))) # Output: minecraft:gold_block ``` ``` -------------------------------- ### MCStructure.placeStructure Source: https://context7.com/sloimayyy/mcschematic/llms.txt Places another structure's blocks into this structure at the specified position. This is similar to `MCSchematic.placeSchematic` but operates at the structure level. ```APIDOC ## MCStructure.placeStructure ### Description Places another structure's blocks into this structure at the specified position. Similar to MCSchematic.placeSchematic but works at the structure level. ### Method - `placeStructure(structure_to_place, position)`: Places the blocks from `structure_to_place` into the current structure, offset by `position`. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import mcschematic # Create a pillar module pillar = mcschematic.MCStructure() for y in range(5): pillar.setBlock((0, y, 0), "minecraft:stone_bricks") # Create main structure main_structure = mcschematic.MCStructure() main_structure.cuboidFilled("minecraft:oak_planks", (0, 0, 0), (20, 0, 20)) # Place pillars at corners main_structure.placeStructure(pillar, (0, 1, 0)) main_structure.placeStructure(pillar, (20, 1, 0)) main_structure.placeStructure(pillar, (0, 1, 20)) main_structure.placeStructure(pillar, (20, 1, 20)) # Wrap in schematic and save schem = mcschematic.MCSchematic(main_structure) schem.save("", "pillared_platform", mcschematic.Version.JE_1_20_4) ``` ### Response #### Success Response (200) This method modifies the structure in place and does not return a value. #### Response Example None ``` -------------------------------- ### Center MCStructure Around an Anchor Point Source: https://context7.com/sloimayyy/mcschematic/llms.txt Centers the MCStructure around the origin (0, 0, 0) or a specified anchor point. This method requires the structure's bounds to be provided for efficient calculation. The bounds can be obtained using the getBounds() method, which can be computationally expensive and should be cached if used frequently. ```Python import mcschematic schem = mcschematic.MCSchematic() # Create an off-center structure schem.setBlock((100, 50, 100), "minecraft:diamond_block") schem.setBlock((102, 50, 100), "minecraft:gold_block") schem.setBlock((100, 52, 102), "minecraft:iron_block") structure = schem.getStructure() # Get bounds (computationally expensive, cache if needed) bounds = structure.getBounds() print(f"Bounds: {bounds}") # ((100, 50, 100), (102, 52, 102)) # Center around origin structure.center(bounds) # Or center around specific point # structure.centerAround(anchorPoint=(10, 10, 10), structureBounds=bounds) # Now structure is centered near origin new_bounds = structure.getBounds() print(f"New bounds: {new_bounds}") schem.save("", "centered", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### MCStructure.getBounds and MCStructure.getStructureDimensions Source: https://context7.com/sloimayyy/mcschematic/llms.txt Computes the bounding box corners and dimensions of a structure. These operations can be computationally expensive, so caching results is recommended for large structures. ```APIDOC ## MCStructure.getBounds / getStructureDimensions ### Description Computes the bounding box corners and dimensions of the structure. These operations are computationally expensive for large structures, so cache results when possible. ### Method - `getBounds()`: Returns the minimum and maximum corner coordinates of the structure. - `getStructureDimensions(bounds)`: Calculates the dimensions (width, height, length) from bounding box corners. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import mcschematic schem = mcschematic.MCSchematic() for i in range(100): schem.setBlock((i, i % 10, i % 20), "minecraft:stone") structure = schem.getStructure() # Get bounding box corners (minXYZ, maxXYZ) bounds = structure.getBounds() min_corner, max_corner = bounds print(f"Min corner: {min_corner}") print(f"Max corner: {max_corner}") # Get dimensions (width, height, length) dimensions = mcschematic.MCStructure.getStructureDimensions(bounds) print(f"Dimensions: {dimensions}") ``` ### Response #### Success Response (200) - `bounds`: A tuple containing two tuples: `(min_corner, max_corner)`, where each corner is an `(x, y, z)` tuple. - `dimensions`: A tuple `(width, height, length)` representing the structure's dimensions. #### Response Example ```json { "min_corner": [0, 0, 0], "max_corner": [99, 9, 19], "dimensions": [100, 10, 20] } ``` ``` -------------------------------- ### BlockDataDB Source: https://context7.com/sloimayyy/mcschematic/llms.txt A static database class providing pre-configured block data strings for containers with specific comparator signal strengths (0-15). Useful for redstone engineers needing precise signal outputs from containers. ```APIDOC ## BlockDataDB ### Description A static database class providing pre-configured block data strings for containers with specific comparator signal strengths (0-15). Useful for redstone engineers who need precise signal outputs from containers. ### Methods - `BlockDataDB.SS_CONTAINER_STRENGTH`: Class constants for specific signal strengths (e.g., `SS_BARREL0`, `SS_BARREL8`, `SS_BARREL15`). - `BlockDataDB.CONTAINER.fromSS(strength)`: A method to dynamically generate block data strings for a given container type and signal strength. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import mcschematic schem = mcschematic.MCSchematic() # Place barrels with specific signal strengths using class constants schem.setBlock((0, 0, 0), mcschematic.BlockDataDB.SS_BARREL0) # Signal strength 0 schem.setBlock((1, 0, 0), mcschematic.BlockDataDB.SS_BARREL8) # Signal strength 8 schem.setBlock((2, 0, 0), mcschematic.BlockDataDB.SS_BARREL15) # Signal strength 15 # Or use the fromSS method for dynamic signal strength for i in range(16): schem.setBlock((i, 1, 0), mcschematic.BlockDataDB.BARREL.fromSS(i)) schem.setBlock((i, 2, 0), mcschematic.BlockDataDB.HOPPER.fromSS(i)) schem.setBlock((i, 3, 0), mcschematic.BlockDataDB.CHEST.fromSS(i)) schem.save("", "signal_strength_demo", mcschematic.Version.JE_1_20_4) ``` ### Response #### Success Response (200) This class provides block data strings and does not have a direct response in terms of data retrieval. The examples show how to use these strings to set blocks. #### Response Example ```json { "block_data_string": "minecraft:barrel[level=8]" } ``` ### Available Container Types BARREL, HOPPER, FURNACE, DISPENSER, DROPPER, TRAPPED_CHEST, CHEST, SHULKER_BOX, SMOKER, BLAST_FURNACE ``` -------------------------------- ### POST /setBlock Source: https://context7.com/sloimayyy/mcschematic/llms.txt Places a block at specific coordinates using Minecraft's blockData string format, including support for block states and NBT data. ```APIDOC ## POST /setBlock ### Description Places a block at the specified relative coordinates. ### Parameters #### Request Body - **coordinates** (tuple) - Required - (x, y, z) position. - **blockData** (str) - Required - Minecraft block string (e.g., 'minecraft:stone[facing=north]{NBT}') ### Request Example schem.setBlock((0, 0, 0), 'minecraft:chest[facing=north]{Items:[{Count:64b,Slot:0b,id:"minecraft:diamond"}]}') ``` -------------------------------- ### Place Structure Within Another (Python) Source: https://context7.com/sloimayyy/mcschematic/llms.txt Places the blocks of one structure into another structure at a specified position. This is similar to `MCSchematic.placeSchematic` but operates at the `MCStructure` level. It takes the structure to be placed and the target coordinates as arguments. ```Python import mcschematic # Create a pillar module pillar = mcschematic.MCStructure() for y in range(5): pillar.setBlock((0, y, 0), "minecraft:stone_bricks") # Create main structure main_structure = mcschematic.MCStructure() main_structure.cuboidFilled("minecraft:oak_planks", (0, 0, 0), (20, 0, 20)) # Place pillars at corners main_structure.placeStructure(pillar, (0, 1, 0)) main_structure.placeStructure(pillar, (20, 1, 0)) main_structure.placeStructure(pillar, (0, 1, 20)) main_structure.placeStructure(pillar, (20, 1, 20)) # Wrap in schematic and save schem = mcschematic.MCSchematic(main_structure) schem.save("", "pillared_platform", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### Specify Minecraft Version for Schematics (Python) Source: https://context7.com/sloimayyy/mcschematic/llms.txt An enumeration of all supported Minecraft Java Edition versions for schematic compatibility, ranging from 1.9 to the latest releases and snapshots. This allows saving schematics with specific version data values for compatibility. ```Python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:stone") # Save for specific versions schem.save("", "for_1_20_4", mcschematic.Version.JE_1_20_4) schem.save("", "for_1_18_2", mcschematic.Version.JE_1_18_2) schem.save("", "for_1_21", mcschematic.Version.JE_1_21) # Snapshots and pre-releases are also available schem.save("", "for_snapshot", mcschematic.Version.JE_24W21A) schem.save("", "for_prerelease", mcschematic.Version.JE_1_21_PRE1) # Access version data value print(mcschematic.Version.JE_1_20_4.value) # Output: 3700 ``` -------------------------------- ### MCSchematic.placeSchematic Source: https://context7.com/sloimayyy/mcschematic/llms.txt Places blocks from another schematic into the current one at a specified position. ```APIDOC ## MCSchematic.placeSchematic ### Description Places another schematic's blocks into the current schematic at the specified position. Useful for combining multiple schematics or creating repeating patterns. ### Method `main_schematic.placeSchematic(schematic_to_place, position)` ### Parameters - **schematic_to_place** (MCSchematic) - Required - The schematic object whose blocks will be placed. - **position** (tuple[int, int, int]) - Required - The (x, y, z) coordinates where the origin (0, 0, 0) of `schematic_to_place` will be placed. ### Request Example ```python import mcschematic # Create a small tower module tower = mcschematic.MCSchematic() tower.setBlock((0, 0, 0), "minecraft:stone_bricks") tower.setBlock((1, 0, 0), "minecraft:stone_bricks") tower.setBlock((0, 0, 1), "minecraft:stone_bricks") tower.setBlock((1, 0, 1), "minecraft:stone_bricks") # Create main schematic and place multiple towers main = mcschematic.MCSchematic() main.placeSchematic(tower, (0, 0, 0)) # First tower at origin main.placeSchematic(tower, (10, 0, 0)) # Second tower offset in X main.placeSchematic(tower, (0, 0, 10)) # Third tower offset in Z main.placeSchematic(tower, (10, 0, 10)) # Fourth tower at corner main.save("", "four_towers", mcschematic.Version.JE_1_20_4) ``` ``` -------------------------------- ### Version Enum Source: https://context7.com/sloimayyy/mcschematic/llms.txt Enumeration of all supported Minecraft Java Edition versions for schematic compatibility. Includes all versions from 1.9 through the latest releases and snapshots. ```APIDOC ## Version Enum ### Description Enumeration of all supported Minecraft Java Edition versions for schematic compatibility. Includes all versions from 1.9 through the latest releases and snapshots. ### Usage Use the enum members to specify the target Minecraft version when saving schematics. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:stone") # Save for specific versions schem.save("", "for_1_20_4", mcschematic.Version.JE_1_20_4) schem.save("", "for_1_18_2", mcschematic.Version.JE_1_18_2) schem.save("", "for_1_21", mcschematic.Version.JE_1_21) # Snapshots and pre-releases are also available schem.save("", "for_snapshot", mcschematic.Version.JE_24W21A) schem.save("", "for_prerelease", mcschematic.Version.JE_1_21_PRE1) # Access version data value print(mcschematic.Version.JE_1_20_4.value) # Output: 3700 ``` ### Response #### Success Response (200) Saving a schematic with a specified version does not return data but creates a file compatible with that version. #### Response Example None ### Available Versions - `JE_1_9` through `JE_1_21` - Snapshot and pre-release versions (e.g., `JE_24W21A`, `JE_1_21_PRE1`) ``` -------------------------------- ### Generate Cuboid Shapes in MCStructure Source: https://context7.com/sloimayyy/mcschematic/llms.txt Provides efficient methods for generating cuboid shapes within an MCStructure. Supports creating filled cuboids (solid), hollow cuboids (walls only), and cuboid outlines (edges only). These methods are more performant than setting individual blocks for large structures. They also support block entities with NBT data. ```Python import mcschematic schem = mcschematic.MCSchematic() structure = schem.getStructure() # Create a filled cuboid (solid block) structure.cuboidFilled("minecraft:stone_bricks", (0, 0, 0), (10, 5, 10)) # Create a hollow cuboid (walls only, empty inside) structure.cuboidHollow("minecraft:glass", (15, 0, 0), (25, 5, 10)) # Create cuboid outlines (edges only, like wireframe) structure.cuboidOutlines("minecraft:glowstone", (30, 0, 0), (40, 5, 10)) # Works with block entities too structure.cuboidFilled( 'minecraft:chest[facing=north]{Items:[{Count:1b,Slot:0b,id:"minecraft:diamond"}]}', (0, 10, 0), (2, 10, 2) ) schem.save("", "cuboid_shapes", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### MCStructure.cuboidFilled / cuboidHollow / cuboidOutlines Source: https://context7.com/sloimayyy/mcschematic/llms.txt Efficiently generates geometric cuboid shapes (filled, hollow, or wireframe) within the structure. ```APIDOC ## METHOD MCStructure.cuboidFilled / cuboidHollow / cuboidOutlines ### Description Generates cuboid shapes. More efficient than individual setBlock calls. ### Parameters - **blockType** (string) - Required - The block ID or block state string. - **start** (tuple) - Required - (x, y, z) start coordinate. - **end** (tuple) - Required - (x, y, z) end coordinate. ### Request Example structure.cuboidFilled("minecraft:stone", (0, 0, 0), (10, 5, 10)) ``` -------------------------------- ### MCStructure.translate Source: https://context7.com/sloimayyy/mcschematic/llms.txt Moves all blocks within an MCStructure by a specified offset. ```APIDOC ## MCStructure.translate ### Description Moves all blocks in the structure by the specified offset vector. This transformation is performed in-place and supports method chaining. ### Method `structure.translate(offset)` ### Parameters - **offset** (tuple[int, int, int]) - Required - The (dx, dy, dz) vector representing the translation offset. ### Request Example ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:diamond_block") schem.setBlock((1, 0, 0), "minecraft:gold_block") structure = schem.getStructure() # Move all blocks by offset structure.translate((10, 5, 10)) # Original positions are now empty print(schem.getBlockStateAt((0, 0, 0))) # Output: minecraft:air # Blocks are at new positions print(schem.getBlockStateAt((10, 5, 10))) # Output: minecraft:diamond_block print(schem.getBlockStateAt((11, 5, 10))) # Output: minecraft:gold_block schem.save("", "translated", mcschematic.Version.JE_1_20_4) ``` ``` -------------------------------- ### Retrieve Full Block Data with getBlockDataAt Source: https://context7.com/sloimayyy/mcschematic/llms.txt Retrieves the complete block data string at a coordinate, including NBT data for block entities. ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), 'minecraft:barrel[facing=up]{Items:[{Count:32b,Slot:0b,id:"minecraft:redstone"}]}') # Get complete block data including NBT block_data = schem.getBlockDataAt((0, 0, 0)) print(block_data) # Output: minecraft:barrel[facing=up]{Items:[{Count:32b,Slot:0b,id:"minecraft:redstone"}]} # For regular blocks, same as getBlockStateAt schem.setBlock((1, 0, 0), "minecraft:diamond_block") print(schem.getBlockDataAt((1, 0, 0))) # Output: minecraft:diamond_block ``` -------------------------------- ### Retrieving Block States Source: https://github.com/sloimayyy/mcschematic/blob/main/README.md Shows how to extract the block state at specific coordinates, excluding NBT data associated with block entities. ```javascript const state = schematic.getBlockStateAt([0, 64, 0]); ``` -------------------------------- ### MCStructure.flip Source: https://context7.com/sloimayyy/mcschematic/llms.txt Mirrors a structure along a specified plane (xy, yz, or xz) through an anchor point. ```APIDOC ## METHOD MCStructure.flip ### Description Flips the structure along the specified plane. Optionally flips directional block states. ### Parameters - **anchorPoint** (tuple) - Required - (x, y, z) coordinate to flip across. - **flippingPlane** (string) - Required - 'xy', 'yz', or 'xz'. - **flipBlockStates** (bool) - Optional - Whether to update directional block states (default: True). ### Request Example structure.flip(anchorPoint=(1, 0, 0), flippingPlane="yz") ``` -------------------------------- ### Rotate MCStructure by Degrees/Radians Source: https://context7.com/sloimayyy/mcschematic/llms.txt Rotates all block positions of an MCStructure around a specified anchor point by given yaw, pitch, and roll angles. Optionally rotates directional block states to maintain orientation. Supports both degrees and radians for rotation. ```Python import mcschematic import math schem = mcschematic.MCSchematic() # Create an L-shaped structure with directional blocks schem.setBlock((0, 0, 0), "minecraft:comparator[facing=north]") schem.setBlock((1, 0, 0), "minecraft:comparator[facing=north]") schem.setBlock((2, 0, 0), "minecraft:comparator[facing=north]") schem.setBlock((2, 0, 1), "minecraft:comparator[facing=east]") schem.setBlock((2, 0, 2), "minecraft:comparator[facing=east]") structure = schem.getStructure() # Rotate 90 degrees counterclockwise (yaw) around origin structure.rotateDegrees(anchorPoint=(1, 0, 1), yaw=90) # Using radians # structure.rotateRadians(anchorPoint=(1, 0, 1), yaw=math.pi/2) # Pitch and roll for 3D rotations (block states only rotate horizontally) structure.rotateDegrees(anchorPoint=(0, 0, 0), yaw=0, pitch=45, roll=0, rotateBlockStates=False) schem.save("", "rotated_structure", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### Flip MCStructure Along a Plane Source: https://context7.com/sloimayyy/mcschematic/llms.txt Flips the MCStructure along a specified plane (xy, yz, or xz) relative to an anchor point. When flipBlockStates is enabled (default), directional block states are also flipped to maintain structural integrity. This is useful for creating mirrored structures. ```Python import mcschematic schem = mcschematic.MCSchematic() # Create an asymmetric structure schem.setBlock((0, 0, 0), "minecraft:oak_stairs[facing=east]") schem.setBlock((1, 0, 0), "minecraft:stone") schem.setBlock((2, 0, 0), "minecraft:cobblestone") schem.setBlock((0, 1, 0), "minecraft:oak_door[facing=east,hinge=left,half=lower]") schem.setBlock((0, 2, 0), "minecraft:oak_door[facing=east,hinge=left,half=upper]") structure = schem.getStructure() # Flip along YZ plane (mirrors in X direction) structure.flip(anchorPoint=(1, 0, 0), flippingPlane="yz") # Other planes: "xy" (mirrors in Z), "xz" (mirrors in Y - vertical flip) # structure.flip(anchorPoint=(0, 0, 0), flippingPlane="xy") schem.save("", "flipped_structure", mcschematic.Version.JE_1_20_4) ``` -------------------------------- ### MCSchematic.getStructure Source: https://context7.com/sloimayyy/mcschematic/llms.txt Retrieves the underlying MCStructure object for advanced transformations. ```APIDOC ## MCSchematic.getStructure ### Description Returns the underlying MCStructure object for direct manipulation. This provides access to transformation methods like translate, rotate, scale, and flip. ### Method `schematic.getStructure()` ### Parameters None ### Request Example ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:oak_stairs[facing=east]") schem.setBlock((1, 0, 0), "minecraft:oak_stairs[facing=east]") schem.setBlock((2, 0, 0), "minecraft:oak_stairs[facing=east]") # Get the structure for transformations structure = schem.getStructure() # Rotate 90 degrees around origin (yaw rotation) structure.rotateDegrees((0, 0, 0), yaw=90) # The stairs are now rotated and facing south print(schem.getBlockStateAt((0, 0, 0))) # Block states are also rotated schem.save("", "rotated_stairs", mcschematic.Version.JE_1_20_4) ``` ``` -------------------------------- ### Retrieve Block State with getBlockStateAt Source: https://context7.com/sloimayyy/mcschematic/llms.txt Retrieves the block state string at a specific coordinate. For block entities, it returns only the state portion, excluding NBT data. ```python import mcschematic schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:oak_stairs[facing=east,half=top]") schem.setBlock((1, 0, 0), 'minecraft:chest[facing=north]{Items:[{Count:1b,Slot:0b,id:"minecraft:diamond"}]}') # Get block state (returns full state for normal blocks) state1 = schem.getBlockStateAt((0, 0, 0)) print(state1) # Output: minecraft:oak_stairs[facing=east,half=top] # For block entities, returns only the state without NBT state2 = schem.getBlockStateAt((1, 0, 0)) print(state2) # Output: minecraft:chest[facing=north] # Empty positions return air state3 = schem.getBlockStateAt((99, 99, 99)) print(state3) # Output: minecraft:air ``` -------------------------------- ### MCStructure.center / centerAround Source: https://context7.com/sloimayyy/mcschematic/llms.txt Aligns the structure's bounding box relative to the origin or a specific anchor point. ```APIDOC ## METHOD MCStructure.center / centerAround ### Description Centers the structure. Requires pre-calculated structure bounds for performance. ### Parameters - **structureBounds** (tuple) - Required - The bounds returned by getBounds(). - **anchorPoint** (tuple) - Optional (for centerAround) - The target coordinate to center around. ### Request Example bounds = structure.getBounds() structure.center(bounds) ``` -------------------------------- ### MCStructure.rotateDegrees / rotateRadians Source: https://context7.com/sloimayyy/mcschematic/llms.txt Rotates all block positions around a specified anchor point using yaw, pitch, and roll angles. ```APIDOC ## METHOD MCStructure.rotateDegrees / MCStructure.rotateRadians ### Description Rotates all block positions around an anchor point by specified yaw, pitch, and roll angles. Optionally rotates directional block states to maintain relative orientation. ### Parameters - **anchorPoint** (tuple) - Required - (x, y, z) coordinate to rotate around. - **yaw** (float) - Optional - Rotation in degrees/radians around Y-axis. - **pitch** (float) - Optional - Rotation in degrees/radians around X-axis. - **roll** (float) - Optional - Rotation in degrees/radians around Z-axis. - **rotateBlockStates** (bool) - Optional - Whether to update directional block states (default: True). ### Request Example structure.rotateDegrees(anchorPoint=(1, 0, 1), yaw=90) ``` -------------------------------- ### Iterate Over Non-Air Blocks (Python) Source: https://context7.com/sloimayyy/mcschematic/llms.txt Returns a generator that iterates over all non-air blocks in a structure. It yields tuples of (coordinates, blockState), which is useful for analyzing or copying structure contents. The function can also be used with collections.Counter to count blocks by type. ```Python import mcschematic from collections import Counter schem = mcschematic.MCSchematic() schem.setBlock((0, 0, 0), "minecraft:diamond_block") schem.setBlock((5, 5, 5), "minecraft:gold_block") schem.setBlock((10, 0, 0), "minecraft:iron_block") structure = schem.getStructure() # Iterate over all non-air blocks for coords, block_state in structure.blockStateIterator(): print(f"Block at {coords}: {block_state}") # Output: # Block at (0, 0, 0): minecraft:diamond_block # Block at (5, 5, 5): minecraft:gold_block # Block at (10, 0, 0): minecraft:iron_block # Count blocks by type block_counts = Counter(state for _, state in structure.blockStateIterator()) print(block_counts) ``` -------------------------------- ### MCSchematic.getSubSchematic Source: https://context7.com/sloimayyy/mcschematic/llms.txt Extracts a specified region from a schematic, with an option to recenter the extracted portion. ```APIDOC ## MCSchematic.getSubSchematic ### Description Extracts a portion of the schematic defined by two corner coordinates. Optionally recenters the extracted portion around (0, 0, 0). ### Method `schematic.getSubSchematic(corner1, corner2, reCenter=False)` ### Parameters - **corner1** (tuple[int, int, int]) - Required - The (x, y, z) coordinates of one corner of the region. - **corner2** (tuple[int, int, int]) - Required - The (x, y, z) coordinates of the opposite corner of the region. - **reCenter** (boolean) - Optional - If True, the extracted sub-schematic will be re-centered around the origin (0, 0, 0). ### Request Example ```python import mcschematic # Create a large schematic big_schem = mcschematic.MCSchematic() for x in range(20): for y in range(10): for z in range(20): if (x + y + z) % 3 == 0: big_schem.setBlock((x, y, z), "minecraft:stone") # Extract a sub-region (corners are inclusive) sub = big_schem.getSubSchematic((5, 2, 5), (10, 7, 10)) sub.save("", "extracted_region", mcschematic.Version.JE_1_20_4) # Extract and recenter around origin sub_centered = big_schem.getSubSchematic((5, 2, 5), (10, 7, 10), reCenter=True) sub_centered.save("", "extracted_centered", mcschematic.Version.JE_1_20_4) ``` ```