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.schematic; 019 020import net.minecraft.block.state.IBlockState; 021 022/** 023 * A static schematic is capable of providing the desired state at a given position without 024 * additional context. Schematics of this type are expected to have non-varying contents. 025 * 026 * @author Brady 027 * @see #getDirect(int, int, int) 028 * @since 12/24/2019 029 */ 030public interface IStaticSchematic extends ISchematic { 031 032 /** 033 * Gets the {@link IBlockState} for a given position in this schematic. It should be guaranteed 034 * that the return value of this method will not change given that the parameters are the same. 035 * 036 * @param x The X block position 037 * @param y The Y block position 038 * @param z The Z block position 039 * @return The desired state at the specified position. 040 */ 041 IBlockState getDirect(int x, int y, int z); 042 043 /** 044 * Returns an {@link IBlockState} array of size {@link #heightY()} which contains all 045 * desired block states in the specified vertical column. The index of {@link IBlockState}s 046 * in the array are equivalent to their Y position in the schematic. 047 * 048 * @param x The X column position 049 * @param z The Z column position 050 * @return An {@link IBlockState} array 051 */ 052 default IBlockState[] getColumn(int x, int z) { 053 IBlockState[] column = new IBlockState[this.heightY()]; 054 for (int i = 0; i < this.heightY(); i++) { 055 column[i] = getDirect(x, i, z); 056 } 057 return column; 058 } 059}