001/*
002 * Trident - A Multithreaded Server Alternative
003 * Copyright 2014 The TridentSDK Team
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *    http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package net.tridentsdk.base;
019
020import net.tridentsdk.meta.block.BlockMetaOwner;
021import net.tridentsdk.util.Vector;
022
023import javax.annotation.concurrent.ThreadSafe;
024
025/**
026 * A basic structure in minecraft, a substance bearing piece set at a given position
027 *
028 * @author The TridentSDK Team
029 * @since 0.3-alpha-DP
030 */
031@ThreadSafe
032public interface Block extends BlockMetaOwner<Block> {
033    /**
034     * Gets the substance the tile is made of
035     *
036     * @return the type the tile was set
037     */
038    Substance substance();
039
040    /**
041     * Sets the substance the tile is made of
042     *
043     * @param substance the substance the tile should be set to
044     */
045    void setSubstance(Substance substance);
046
047    /**
048     * Sets the substance the tile is made of and its tile data
049     *
050     * @param substance the substance the tile should be set to
051     * @param data the data the tile should be set to
052     */
053    void setSubstanceAndMeta(Substance substance, byte data);
054
055    /**
056     * Returns the Location of the Block
057     *
058     * @return Location of the Block
059     */
060    Position position();
061
062    /**
063     * Gets the tile data
064     *
065     * @return the data of the tile
066     */
067    byte meta();
068
069    /**
070     * Sets the tile data
071     *
072     * @param data the data to set the tile
073     */
074    void setMeta(byte data);
075
076    /**
077     * Returns a block immediately to the direction specified
078     *
079     * @param vector the direction to look for the block adjacent to the current
080     * @return the block adjacent to the current
081     */
082    Block relativeBlock(Vector vector);
083}