Search in sources :

Example 1 with SelectionSchematic

use of baritone.utils.schematic.SelectionSchematic in project baritone by cabaletta.

the class BuilderProcess method buildOpenSchematic.

@Override
public void buildOpenSchematic() {
    if (SchematicaHelper.isSchematicaPresent()) {
        Optional<Tuple<IStaticSchematic, BlockPos>> schematic = SchematicaHelper.getOpenSchematic();
        if (schematic.isPresent()) {
            IStaticSchematic s = schematic.get().getFirst();
            BlockPos origin = schematic.get().getSecond();
            ISchematic schem = Baritone.settings().mapArtMode.value ? new MapArtSchematic(s) : s;
            if (Baritone.settings().buildOnlySelection.value) {
                schem = new SelectionSchematic(schem, origin, baritone.getSelectionManager().getSelections());
            }
            this.build(schematic.get().getFirst().toString(), schem, origin);
        } else {
            logDirect("No schematic currently open");
        }
    } else {
        logDirect("Schematica is not present");
    }
}
Also used : ISchematic(baritone.api.schematic.ISchematic) IStaticSchematic(baritone.api.schematic.IStaticSchematic) SelectionSchematic(baritone.utils.schematic.SelectionSchematic) BetterBlockPos(baritone.api.utils.BetterBlockPos) Tuple(net.minecraft.util.Tuple) MapArtSchematic(baritone.utils.schematic.MapArtSchematic)

Example 2 with SelectionSchematic

use of baritone.utils.schematic.SelectionSchematic in project baritone by cabaletta.

the class BuilderProcess method build.

@Override
public boolean build(String name, File schematic, Vec3i origin) {
    Optional<ISchematicFormat> format = SchematicSystem.INSTANCE.getByFile(schematic);
    if (!format.isPresent()) {
        return false;
    }
    ISchematic parsed;
    try {
        parsed = format.get().parse(new FileInputStream(schematic));
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    if (Baritone.settings().mapArtMode.value) {
        parsed = new MapArtSchematic((IStaticSchematic) parsed);
    }
    if (Baritone.settings().buildOnlySelection.value) {
        parsed = new SelectionSchematic(parsed, origin, baritone.getSelectionManager().getSelections());
    }
    build(name, parsed, origin);
    return true;
}
Also used : ISchematic(baritone.api.schematic.ISchematic) IStaticSchematic(baritone.api.schematic.IStaticSchematic) SelectionSchematic(baritone.utils.schematic.SelectionSchematic) ISchematicFormat(baritone.api.schematic.format.ISchematicFormat) FileInputStream(java.io.FileInputStream) MapArtSchematic(baritone.utils.schematic.MapArtSchematic)

Aggregations

ISchematic (baritone.api.schematic.ISchematic)2 IStaticSchematic (baritone.api.schematic.IStaticSchematic)2 MapArtSchematic (baritone.utils.schematic.MapArtSchematic)2 SelectionSchematic (baritone.utils.schematic.SelectionSchematic)2 ISchematicFormat (baritone.api.schematic.format.ISchematicFormat)1 BetterBlockPos (baritone.api.utils.BetterBlockPos)1 FileInputStream (java.io.FileInputStream)1 Tuple (net.minecraft.util.Tuple)1