From d8ca6cad4e9d95eb006325864029853d4697a799 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 9 Sep 2018 13:19:48 -0700 Subject: [PATCH] i am an idiot 2: electric boogaloo --- .../baritone/pathing/movement/MovementHelper.java | 11 +++++------ .../java/baritone/utils/ExampleBaritoneControl.java | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 1036b69fe..dc66d2029 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -52,15 +52,14 @@ public interface MovementHelper extends ActionCosts, Helper { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); - Block below = BlockStateInterface.get(x, y - 1, z).getBlock(); return b == Blocks.ICE // ice becomes water, and water can mess up the path || b instanceof BlockSilverfish // obvious reasons // call BlockStateInterface.get directly with x,y,z. no need to make 5 new BlockPos for no reason - || BlockStateInterface.get(x, y + 1, z) instanceof BlockLiquid//don't break anything touching liquid on any side - || BlockStateInterface.get(x + 1, y, z) instanceof BlockLiquid - || BlockStateInterface.get(x - 1, y, z) instanceof BlockLiquid - || BlockStateInterface.get(x, y, z + 1) instanceof BlockLiquid - || BlockStateInterface.get(x, y, z - 1) instanceof BlockLiquid; + || BlockStateInterface.get(x, y + 1, z).getBlock() instanceof BlockLiquid//don't break anything touching liquid on any side + || BlockStateInterface.get(x + 1, y, z).getBlock() instanceof BlockLiquid + || BlockStateInterface.get(x - 1, y, z).getBlock() instanceof BlockLiquid + || BlockStateInterface.get(x, y, z + 1).getBlock() instanceof BlockLiquid + || BlockStateInterface.get(x, y, z - 1).getBlock() instanceof BlockLiquid; } /** diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 492c36527..c3eb40aa4 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -314,6 +314,9 @@ public class ExampleBaritoneControl extends Behavior { if (msg.toLowerCase().equals("costs")) { Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext()); List moves = new ArrayList<>(Arrays.asList(movements)); + while (moves.contains(null)) { + moves.remove(null); + } moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext()))); for (Movement move : moves) { String[] parts = move.getClass().toString().split("\\.");