Skip to content

Phobos 3.0.0

sagan edited this page Aug 19, 2021 · 1 revision

Usage

To build a schematic:

SchemBuilder.from(
        myPluginInstance, 
        Path.of("C:\\path\\to\\schematic\\house.schem").toFile()
        ).ifPresentOrElse(schemBuilder -> {
            schemBuilder.buildAt(someLocation);
        }, () -> {
            System.out.println("Oh no! Path invalid or loading error :(");
        });

Easy right? However, this doesn't do anything cool that phobos was made for. Maybe something like this:

SchemBuilder.from(
        myPluginInstance, 
        Path.of("C:\\path\\to\\schematic\\house.schem").toFile()
        ).ifPresentOrElse(schemBuilder -> {
            schemBuilder
                .buildPattern(new RandomBuildPattern())
                .placeEffect(new GreenSparkleEffect())
                .ticksBetweenIterations(5)
                .ignoreAir(true)
                .buildAt(someLocation);
        }, () -> {
            System.out.println("Oh no! Path invalid or loading error :(");
        });

This will build the same schematic but with the following characteristics accordingly:

  1. Will place blocks randomly (the build pattern)
  2. Green sparkles will be played at a location around the block (the place effect)
  3. Will wait 5 ticks before placing a set of blocks (ticks between iterations)
  4. Will ignore air blocks in the clipboard and not place them (ignore air)

The power is yours now. You can make custom block place effect and build pattern classes implementing/extending PlaceEffect and BuildPattern respectively. Look at existing examples in phobos for an idea of what these do and how to make them

[NOTE]: You also get access to the Clipboard loaded into the schematic builder via SchemBuilder#.getClipboard(). With this you can apply rotations and transformations to the clipboard before it is built. (All sorting/arranging done in these build patterns is done async)

Have Fun!

Clone this wiki locally