Edit structure block .nbt files

Builds saved with a structure block are NBT files. Learn where they are, how palette, blocks and entities fit together, and how to swap materials or fix a structure.

When you save a build with a structure block in Save mode, Minecraft writes it to an NBT file that you can load into any world. The same format is used by data packs for custom structures, and it is easy to edit once you see how the block list and the palette work together.

Where structures are saved

  • Saved with a structure block: in the world folder, generated/<namespace>/structures/<name>.nbt up to 1.21.11, and generated/<namespace>/structure/<name>.nbt from 26.1. A structure named castle uses the minecraft namespace; one named mypack:castle goes under mypack.
  • In a data pack: data/<namespace>/structure/ (the folder was structures before 1.21).

How the file is organized

A small structure: three blocks, one entity
  • { }root
    • IDataVersion4671
    • [ ]size3 Ints: width, height, length
    • [ ]palette
      • { }0
        • StrName"minecraft:oak_planks"
      • { }1
        • StrName"minecraft:chest"
        • { }Properties
          • Strfacing"north"
          • Strtype"single"
          • Strwaterlogged"false"
    • [ ]blocks
      • { }0
        • Istate0palette index
        • [ ]pos3 Ints, relative to the corner
      • { }1
        • Istate1
        • [ ]pos
        • { }nbtthe chest's contents
    • [ ]entities
      • { }0
        • [ ]pos3 Doubles
        • [ ]blockPos3 Ints
        • { }nbtentity data
  • [ ]palette lists each distinct block state once: a block id in StrName and, for blocks with states, their { }Properties. Property values are always Strings, even "false" and "3".
  • [ ]blocks has one entry per block position. Istate is a position in the palette list (counting from 0), and [ ]pos is the position relative to the structure's corner. Blocks with contents, such as chests or signs, also carry an { }nbt compound.
  • [ ]entities holds mobs, armor stands, item frames and so on, with their exact position.
  • [ ]size gives the dimensions. Air is saved like any other block, which is why loading a structure clears what was there. Only positions filled with structure void blocks are left out of blocks.

Swap a material everywhere

Because blocks point to the palette, changing one palette entry changes every block that uses it. To rebuild an oak house in spruce:

  1. Open the .nbt file in the editor and expand palette.
  2. Use the search box to find oak. Change minecraft:oak_planks to minecraft:spruce_planks, minecraft:oak_stairs to minecraft:spruce_stairs, and so on.
  3. Keep the Properties as they are, as long as the new block has the same properties. Stairs keep their facing, half and shape.
  4. Download with the same name and put the file back. Load it with a structure block in Load mode.

If the new block doesn't have a property the old one had, the game ignores the extra property. If it needs a property that's missing, it uses the default value.

Other useful edits

  • Remove all entities: open the ☰ menu on each entry in entities and remove it, or switch to the SNBT view and replace the list with [].
  • Change a chest's loot: find the chest's entry in blocks and edit its nbt › Items. Items use the same format as a player inventory, with a Slot from 0 to 26.
  • Turn a block's state: edit its palette entry's Properties, for example facing from north to east. Every block sharing that palette entry turns too.

Schematics and Bedrock structures

WorldEdit .schem files and Litematica .litematic files are gzip-compressed NBT as well, so the editor opens them. Both pack their block data into compact arrays that aren't meant to be edited by hand; the editor keeps those arrays byte for byte, so you can safely change names, metadata or entities and save the file.

Bedrock's .mcstructure files are uncompressed little-endian NBT. They use their own layout, with a structure compound holding block indices and a palette, but the editor reads and writes them in their original format.

Ready to edit?Open the file in the editor: every value keeps its NBT type and the file is saved in its original format.