diff --git a/src/api/java/baritone/api/utils/IPlayerController.java b/src/api/java/baritone/api/utils/IPlayerController.java index dced5286..14334d5e 100644 --- a/src/api/java/baritone/api/utils/IPlayerController.java +++ b/src/api/java/baritone/api/utils/IPlayerController.java @@ -50,4 +50,6 @@ public interface IPlayerController { } EnumActionResult processRightClickBlock(EntityPlayerSP player, World world, BlockPos pos, EnumFacing direction, Vec3d vec, EnumHand hand); + + EnumActionResult processRightClick(EntityPlayerSP player, World world, EnumHand hand); } diff --git a/src/main/java/baritone/utils/BlockPlaceHelper.java b/src/main/java/baritone/utils/BlockPlaceHelper.java index 8e7ef44a..ed472d57 100644 --- a/src/main/java/baritone/utils/BlockPlaceHelper.java +++ b/src/main/java/baritone/utils/BlockPlaceHelper.java @@ -46,6 +46,9 @@ public class BlockPlaceHelper implements Helper { ctx.player().swingArm(hand); return; } + if (!ctx.player().getHeldItem(hand).isEmpty() && ctx.playerController().processRightClick(ctx.player(), ctx.world(), hand) == EnumActionResult.SUCCESS) { + return; + } } } } diff --git a/src/main/java/baritone/utils/player/PrimaryPlayerController.java b/src/main/java/baritone/utils/player/PrimaryPlayerController.java index 76e389e7..b9828c80 100644 --- a/src/main/java/baritone/utils/player/PrimaryPlayerController.java +++ b/src/main/java/baritone/utils/player/PrimaryPlayerController.java @@ -72,4 +72,9 @@ public enum PrimaryPlayerController implements IPlayerController, Helper { // primaryplayercontroller is always in a WorldClient so this is ok return mc.playerController.processRightClickBlock(player, (WorldClient) world, pos, direction, vec, hand); } + + @Override + public EnumActionResult processRightClick(EntityPlayerSP player, World world, EnumHand hand) { + return mc.playerController.processRightClick(player, world, hand); + } }