From a8ef421757b5eb76d6af7d0cc830dd0a6144ba5d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 9 Sep 2018 08:57:20 -0700 Subject: [PATCH] epic performance --- .../pathing/movement/MovementHelper.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 832663cc..1dbcfae5 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -48,14 +48,18 @@ public interface MovementHelper extends ActionCosts, Helper { static boolean avoidBreaking(BlockPos pos, IBlockState state) { Block b = state.getBlock(); - Block below = BlockStateInterface.get(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock(); - return Blocks.ICE.equals(b) // ice becomes water, and water can mess up the path + 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 - || BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))//don't break anything touching liquid on any side - || BlockStateInterface.isLiquid(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ())) - || BlockStateInterface.isLiquid(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ())) - || BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)) - || BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1)); + // 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; } /**