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.utils.BlockOptionalMeta; 021import baritone.api.utils.BlockOptionalMetaLookup; 022import net.minecraft.block.Block; 023 024import java.util.stream.Stream; 025 026/** 027 * @author Brady 028 * @since 9/23/2018 029 */ 030public interface IMineProcess extends IBaritoneProcess { 031 032 /** 033 * Begin to search for and mine the specified blocks until 034 * the number of specified items to get from the blocks that 035 * are mined. 036 * 037 * @param quantity The total number of items to get 038 * @param blocks The blocks to mine 039 */ 040 void mineByName(int quantity, String... blocks); 041 042 /** 043 * Begin to search for and mine the specified blocks until 044 * the number of specified items to get from the blocks that 045 * are mined. This is based on the first target block to mine. 046 * 047 * @param quantity The number of items to get from blocks mined 048 * @param filter The blocks to mine 049 */ 050 void mine(int quantity, BlockOptionalMetaLookup filter); 051 052 /** 053 * Begin to search for and mine the specified blocks. 054 * 055 * @param filter The blocks to mine 056 */ 057 default void mine(BlockOptionalMetaLookup filter) { 058 mine(0, filter); 059 } 060 061 /** 062 * Begin to search for and mine the specified blocks. 063 * 064 * @param blocks The blocks to mine 065 */ 066 default void mineByName(String... blocks) { 067 mineByName(0, blocks); 068 } 069 070 /** 071 * Begin to search for and mine the specified blocks. 072 * 073 * @param boms The blocks to mine 074 */ 075 default void mine(int quantity, BlockOptionalMeta... boms) { 076 mine(quantity, new BlockOptionalMetaLookup(boms)); 077 } 078 079 /** 080 * Begin to search for and mine the specified blocks. 081 * 082 * @param boms The blocks to mine 083 */ 084 default void mine(BlockOptionalMeta... boms) { 085 mine(0, boms); 086 } 087 088 /** 089 * Begin to search for and mine the specified blocks. 090 * 091 * @param quantity The total number of items to get 092 * @param blocks The blocks to mine 093 */ 094 default void mine(int quantity, Block... blocks) { 095 mine(quantity, new BlockOptionalMetaLookup( 096 Stream.of(blocks) 097 .map(BlockOptionalMeta::new) 098 .toArray(BlockOptionalMeta[]::new) 099 )); 100 } 101 102 /** 103 * Begin to search for and mine the specified blocks. 104 * 105 * @param blocks The blocks to mine 106 */ 107 default void mine(Block... blocks) { 108 mine(0, blocks); 109 } 110 111 /** 112 * Cancels the current mining task 113 */ 114 default void cancel() { 115 onLostControl(); 116 } 117}