Create and manipulate MCEdit Schematic files in PocketMine-MP plugins.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/BlockHorizons/libschematic
.gitignore
.poggit.yml
README.md
virion.yml

README.md

libschematic

A library for creating and manipulating MCEdit Schematic files.

Implementing into plugins

Best way to implement this code is to use it as a git module.

Usage

Loading schematic files

try {
	$schematic = new Schematic("castle.schematic");
	$schematic->decode();
} catch (\Throwable $error) {
	// Handle error
}

Saving schematic files

try {
	$schematic->encode();
	$schematic->save("castle.schematic"); // With custom name
	$schematic->save(); // With the name you used before
} catch (\Throwable $error) {
	// Handle error
}

Pasting schematics

$target = $player->getPosition();
foreach($schematic->getBlocks() as $block) {
	$target->level->setBlock($target->add($block), $block);
}

Fixing Block IDs

If you have blocks not currently in PMMP/MCPE, you will need to call the following after loading a schematic:

$schematic->fixBlockIds();

I'm a fluent person

So am I!

try {
	new Schematic("castle.schematic")
		->decode()
		->setBlocks(...)
		->setEntities(...)
		->save();
} catch (\Throwable $error) {
	// Handle error
}