Search in sources :

Example 1 with ISchematicFormat

use of baritone.api.schematic.format.ISchematicFormat in project Spark-Client by Spark-Client-Development.

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.getValue()) {
        parsed = new MapArtSchematic((IStaticSchematic) parsed);
    }
    build(name, parsed, origin);
    return true;
}
Also used : ISchematic(baritone.api.schematic.ISchematic) IStaticSchematic(baritone.api.schematic.IStaticSchematic) ISchematicFormat(baritone.api.schematic.format.ISchematicFormat) FileInputStream(java.io.FileInputStream) MapArtSchematic(baritone.utils.schematic.MapArtSchematic)

Example 2 with ISchematicFormat

use of baritone.api.schematic.format.ISchematicFormat 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 ISchematicFormat (baritone.api.schematic.format.ISchematicFormat)2 MapArtSchematic (baritone.utils.schematic.MapArtSchematic)2 FileInputStream (java.io.FileInputStream)2 SelectionSchematic (baritone.utils.schematic.SelectionSchematic)1