Skip to content

StructureTemplateStorage 5.47.0 ​

final class · pocketmine\world\structure\StructureTemplateStorage · source

The structure templates of a world, like vanilla's StructureManager: templates saved "in memory" only live until the server stops; templates saved "to disk" are written to the world database under the vanilla key "structuretemplate_<name>", so they round-trip with Bedrock Dedicated Server (worlds which are not LevelDB worlds keep them as .mcstructure files in a "structures" folder). Recently loaded templates are cached (the structure block screen queries the template of its name again and again): a few small ones, and the last one too big for them.

Constants ​

LEVELDB_KEY_PREFIX ​

php
public const LEVELDB_KEY_PREFIX = "structuretemplate_"

Methods ​

delete() ​

php
public function delete(string $name) : bool

Deletes the template of the given name from memory and disk. Returns whether there was one.

get() ​

php
public static function get(\pocketmine\world\World $world) : self

load() ​

php
public function load(string $name) : ?\pocketmine\world\structure\StructureTemplate

Returns the template of the given name (memory first, then disk), or null if there is none.

save() ​

php
public function save(string $name, \pocketmine\world\structure\StructureTemplate $template, bool $toDisk) : void

Saves a template in memory, or to disk.

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.