001/*
002 * This file is part of Baritone.
003 *
004 * Baritone is free software: you can redistribute it and/or modify
005 * it under the terms of the GNU Lesser General Public License as published by
006 * the Free Software Foundation, either version 3 of the License, or
007 * (at your option) any later version.
008 *
009 * Baritone is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU Lesser General Public License for more details.
013 *
014 * You should have received a copy of the GNU Lesser General Public License
015 * along with Baritone.  If not, see <https://www.gnu.org/licenses/>.
016 */
017
018package baritone.api.process;
019
020import baritone.api.schematic.ISchematic;
021import net.minecraft.block.state.IBlockState;
022import net.minecraft.client.Minecraft;
023import net.minecraft.util.math.BlockPos;
024import net.minecraft.util.math.Vec3i;
025
026import java.io.File;
027import java.util.List;
028
029/**
030 * @author Brady
031 * @since 1/15/2019
032 */
033public interface IBuilderProcess extends IBaritoneProcess {
034
035    /**
036     * Requests a build for the specified schematic, labeled as specified, with the specified origin.
037     *
038     * @param name      A user-friendly name for the schematic
039     * @param schematic The object representation of the schematic
040     * @param origin    The origin position of the schematic being built
041     */
042    void build(String name, ISchematic schematic, Vec3i origin);
043
044    /**
045     * Requests a build for the specified schematic, labeled as specified, with the specified origin.
046     *
047     * @param name      A user-friendly name for the schematic
048     * @param schematic The file path of the schematic
049     * @param origin    The origin position of the schematic being built
050     * @return Whether or not the schematic was able to load from file
051     */
052    boolean build(String name, File schematic, Vec3i origin);
053
054    default boolean build(String schematicFile, BlockPos origin) {
055        File file = new File(new File(Minecraft.getMinecraft().gameDir, "schematics"), schematicFile);
056        return build(schematicFile, file, origin);
057    }
058
059    void buildOpenSchematic();
060
061    void buildOpenLitematic(int i);
062
063    void pause();
064
065    boolean isPaused();
066
067    void resume();
068
069    void clearArea(BlockPos corner1, BlockPos corner2);
070
071    /**
072     * @return A list of block states that are estimated to be placeable by this builder process. You can use this in
073     * schematics, for example, to pick a state that the builder process will be happy with, because any variation will
074     * cause it to give up. This is updated every tick, but only while the builder process is active.
075     */
076    List<IBlockState> getApproxPlaceable();
077}