From d3ae1d27c842be0f8a26dea6f54551f880b406d6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 11 Aug 2018 17:13:12 -0700 Subject: [PATCH] setting goal to playerFeet is fixed and misc cleanup --- .../java/baritone/bot/behavior/impl/PathingBehavior.java | 3 +++ .../bot/pathing/movement/movements/MovementAscend.java | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java index a26e61d8..7de59a45 100644 --- a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java @@ -67,6 +67,9 @@ public class PathingBehavior extends Behavior { if (msg.toLowerCase().startsWith("goal")) { event.cancel(); String[] params = msg.toLowerCase().substring(4).trim().split(" "); + if (params[0].equals("")) { + params = new String[]{}; + } try { switch (params.length) { case 0: diff --git a/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java index e855c1f9..02db378f 100644 --- a/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/bot/pathing/movement/movements/MovementAscend.java @@ -28,7 +28,6 @@ import baritone.bot.utils.BlockStateInterface; import baritone.bot.utils.Utils; import net.minecraft.block.BlockFalling; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -103,7 +102,6 @@ public class MovementAscend extends Movement { return state; } - EntityPlayerSP thePlayer = Minecraft.getMinecraft().player; if (!MovementHelper.canWalkOn(positionsToPlace[0])) { for (int i = 0; i < against.length; i++) { if (BlockStateInterface.get(against[i]).isBlockNormalCube()) { @@ -114,12 +112,11 @@ public class MovementAscend extends Movement { double faceY = (dest.getY() + against[i].getY()) * 0.5D; double faceZ = (dest.getZ() + against[i].getZ() + 1.0D) * 0.5D; state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), new Vec3d(faceX, faceY, faceZ), playerRotations()))); - EnumFacing side = Minecraft.getMinecraft().objectMouseOver.sideHit; if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), against[i]) && LookBehaviorUtils.getSelectedBlock().get().offset(side).equals(positionsToPlace[0])) { ticksWithoutPlacement++; state.setInput(InputOverrideHandler.Input.SNEAK, true); - if (Minecraft.getMinecraft().player.isSneaking()) { + if (player().isSneaking()) { state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); } if (ticksWithoutPlacement > 20) { @@ -134,6 +131,8 @@ public class MovementAscend extends Movement { } MovementHelper.moveTowards(state, dest); state.setInput(InputOverrideHandler.Input.JUMP, true); + + // TODO check if the below actually helps or hurts, it's weird //double flatDistToNext = Math.abs(to.getX() - from.getX()) * Math.abs((to.getX() + 0.5D) - thePlayer.posX) + Math.abs(to.getZ() - from.getZ()) * Math.abs((to.getZ() + 0.5D) - thePlayer.posZ); //boolean pointingInCorrectDirection = MovementManager.moveTowardsBlock(to); //MovementManager.jumping = flatDistToNext < 1.2 && pointingInCorrectDirection;