From d7a646789e6f5a804db095830d3e64c9547ce1dc Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 08:40:34 -0700 Subject: [PATCH] fixes to parkour place --- src/main/java/baritone/Settings.java | 5 +++++ .../movement/movements/MovementParkour.java | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index eb673efd..fddb7bce 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -104,6 +104,11 @@ public class Settings { */ public Setting allowParkour = new Setting<>(false); + /** + * Like parkour, but even more unreliable! + */ + public Setting allowParkourPlace = new Setting<>(false); + /** * For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly. */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index dc586fac..130d7244 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -81,7 +81,7 @@ public class MovementParkour extends Movement { if (!MovementHelper.fullyPassable(src.up(2))) { return null; } - for (int i = 2; i <= 4; i++) { + for (int i = 2; i <= (context.canSprint() ? 4 : 3); i++) { BlockPos dest = src.offset(dir, i); // TODO perhaps dest.up(3) doesn't need to be fullyPassable, just canWalkThrough, possibly? for (int y = 0; y < 4; y++) { @@ -93,6 +93,12 @@ public class MovementParkour extends Movement { return new MovementParkour(src, i, dir); } } + if (!context.canSprint()) { + return null; + } + if (!Baritone.settings().allowParkourPlace.get()) { + return null; + } BlockPos dest = src.offset(dir, 4); BlockPos positionToPlace = dest.down(); IBlockState toPlace = BlockStateInterface.get(positionToPlace); @@ -133,11 +139,17 @@ public class MovementParkour extends Movement { @Override protected double calculateCost(CalculationContext context) { // MUST BE KEPT IN SYNC WITH generate + if (!context.canSprint() && dist >= 4) { + return COST_INF; + } boolean placing = false; if (!MovementHelper.canWalkOn(dest.down())) { if (dist != 4) { return COST_INF; } + if (!Baritone.settings().allowParkourPlace.get()) { + return COST_INF; + } BlockPos positionToPlace = dest.down(); IBlockState toPlace = BlockStateInterface.get(positionToPlace); if (!context.hasThrowaway()) {