StructureTemplate 5.47.0
A Bedrock structure template: the format of .mcstructure files, also stored in the world database under the key "structuretemplate_<name>" (verified with BDS 1.26.52, which writes format_version 2).
Blocks are stored in two layers (the second one holds the water of waterlogged blocks) of palette indexes, ordered by x, then y, then z (see StructureTemplate::index()). An index outside the palette (-1, which reads back as 0xffffffff from an int array) is a structure void: the block in the world is left as it is. Block entity data is keyed by block index; block entities and entities keep the world coordinates they had when saved, relative to StructureTemplate::getWorldOrigin().
Constants
FORMAT_VERSION
public const FORMAT_VERSION = 2MAX_VOLUME
public const MAX_VOLUME = 64 * 384 * 64 * 4Largest number of blocks accepted from saved data (four times the biggest structure block area)
TAG_BLOCK_ENTITY_DATA
public const TAG_BLOCK_ENTITY_DATA = "block_entity_data"TAG_BLOCK_INDICES
public const TAG_BLOCK_INDICES = "block_indices"TAG_BLOCK_PALETTE
public const TAG_BLOCK_PALETTE = "block_palette"TAG_BLOCK_POSITION_DATA
public const TAG_BLOCK_POSITION_DATA = "block_position_data"TAG_DEFAULT_PALETTE
public const TAG_DEFAULT_PALETTE = "default"TAG_ENTITIES
public const TAG_ENTITIES = "entities"TAG_FORMAT_VERSION
public const TAG_FORMAT_VERSION = "format_version"TAG_PALETTE
public const TAG_PALETTE = "palette"TAG_SIZE
public const TAG_SIZE = "size"TAG_STRUCTURE
public const TAG_STRUCTURE = "structure"TAG_WORLD_ORIGIN
public const TAG_WORLD_ORIGIN = "structure_world_origin"VOID
public const VOID = -1Methods
__construct()
public function __construct(int $sizeX, int $sizeY, int $sizeZ, array $palette, array $blocks, ?array $liquids = null, array $blockEntities = [], array $entities = [], int $originX = 0, int $originY = 0, int $originZ = 0)empty()
public static function empty(int $sizeX, int $sizeY, int $sizeZ) : selfCreates a template where every block is a structure void.
fromBinary()
public static function fromBinary(string $data) : selffromNbt()
public static function fromNbt(\pocketmine\nbt\tag\CompoundTag $root) : selfgetBlockEntities()
public function getBlockEntities() : arraygetBlockEntity()
public function getBlockEntity(int $index) : ?\pocketmine\nbt\tag\CompoundTaggetBlocks()
public function getBlocks() : arraygetEntities()
public function getEntities() : arraygetLiquidPaletteIndex()
public function getLiquidPaletteIndex(int $index) : ?intPalette index of the liquid (layer 1) at the given block index, or null if there is none.
getLiquids()
public function getLiquids() : ?arraygetPalette()
public function getPalette() : arraygetPaletteIndex()
public function getPaletteIndex(int $index) : ?intPalette index of the block at the given block index, or null for a structure void.
getSizeX()
public function getSizeX() : intgetSizeY()
public function getSizeY() : intgetSizeZ()
public function getSizeZ() : intgetVolume()
public function getVolume() : intgetWorldOrigin()
public function getWorldOrigin() : arrayindex()
public static function index(int $x, int $y, int $z, int $sizeY, int $sizeZ) : intIndex of the block at x/y/z (relative to the template) in the block layers.
isEmpty()
public function isEmpty() : boolWhether the template has neither blocks (all structure voids) nor entities: vanilla refuses to save or load such a structure.
toBinary()
public function toBinary() : stringtoNbt()
public function toNbt() : \pocketmine\nbt\tag\CompoundTag