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.player.LocalPlayer; 022import net.minecraft.core.BlockPos; 023import net.minecraft.core.Direction; 024import net.minecraft.world.InteractionHand; 025import net.minecraft.world.InteractionResult; 026import net.minecraft.world.entity.player.Player; 027import net.minecraft.world.inventory.ClickType; 028import net.minecraft.world.level.GameType; 029import net.minecraft.world.level.Level; 030import net.minecraft.world.phys.BlockHitResult; 031 032/** 033 * @author Brady 034 * @since 12/14/2018 035 */ 036public interface IPlayerController { 037 038 void syncHeldItem(); 039 040 boolean hasBrokenBlock(); 041 042 boolean onPlayerDamageBlock(BlockPos pos, Direction side); 043 044 void resetBlockRemoving(); 045 046 void windowClick(int windowId, int slotId, int mouseButton, ClickType type, Player player); 047 048 GameType getGameType(); 049 050 InteractionResult processRightClickBlock(LocalPlayer player, Level world, InteractionHand hand, BlockHitResult result); 051 052 InteractionResult processRightClick(LocalPlayer player, Level world, InteractionHand hand); 053 054 boolean clickBlock(BlockPos loc, Direction face); 055 056 void setHittingBlock(boolean hittingBlock); 057 058 default double getBlockReachDistance() { 059 return this.getGameType().isCreative() ? 5.0F : BaritoneAPI.getSettings().blockReachDistance.value; 060 } 061}