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.utils;
019
020import baritone.api.BaritoneAPI;
021import net.minecraft.client.entity.EntityPlayerSP;
022import net.minecraft.entity.player.EntityPlayer;
023import net.minecraft.inventory.ClickType;
024import net.minecraft.item.ItemStack;
025import net.minecraft.util.EnumActionResult;
026import net.minecraft.util.EnumFacing;
027import net.minecraft.util.EnumHand;
028import net.minecraft.util.math.BlockPos;
029import net.minecraft.util.math.Vec3d;
030import net.minecraft.world.GameType;
031import net.minecraft.world.World;
032
033/**
034 * @author Brady
035 * @since 12/14/2018
036 */
037public interface IPlayerController {
038
039    void syncHeldItem();
040
041    boolean hasBrokenBlock();
042
043    boolean onPlayerDamageBlock(BlockPos pos, EnumFacing side);
044
045    void resetBlockRemoving();
046
047    ItemStack windowClick(int windowId, int slotId, int mouseButton, ClickType type, EntityPlayer player);
048
049    GameType getGameType();
050
051    EnumActionResult processRightClickBlock(EntityPlayerSP player, World world, BlockPos pos, EnumFacing direction, Vec3d vec, EnumHand hand);
052
053    EnumActionResult processRightClick(EntityPlayerSP player, World world, EnumHand hand);
054
055    boolean clickBlock(BlockPos loc, EnumFacing face);
056
057    void setHittingBlock(boolean hittingBlock);
058
059    default double getBlockReachDistance() {
060        return this.getGameType().isCreative() ? 5.0F : BaritoneAPI.getSettings().blockReachDistance.value;
061    }
062}