Library API

Save a loaded build to the player's schematics folder.

Save any loaded build as a .litematic in the schematics folder, as if the player had saved it. Most useful with previews, which have no file until one is saved. From BuildPrint 0.1.19.

Java
boolean started = BuildprintLibrary.save("mymod", id, "Castle restyled", path -> {
    if (path != null) player.displayClientMessage(Component.literal("Saved " + path), true);
});

Good to know #

  • It never writes over a file. When the name is taken, the new file gets a number.
  • Characters a file name cannot hold, and spaces, become _.
  • It saves the blueprint as it is now, before turning. Blocks the player swapped in BuildPrint are saved as the blueprint's own blocks.
  • The file is written off the client thread. The callback runs on the client thread once it is on disk.
  • The player is not told. Tell them yourself if they asked for the save.

Reference #

BuildprintLibraryWhat it does
isAvailable()In a world.
save(String owner, int id, String name, Consumer<String> done)Write the build to <name>.litematic. done gets the path inside the schematics folder, or null when writing failed. Returns false, without calling done, when there is no such build.

Something missing or wrong on this page? Say so on Discord.