max no bucket fall height setting, fixes #58
This commit is contained in:
parent
92ec2a35c6
commit
a16301b989
@ -122,6 +122,13 @@ public class Settings {
|
|||||||
*/
|
*/
|
||||||
public Setting<Integer> planningTickLookAhead = new Setting<>(100);
|
public Setting<Integer> planningTickLookAhead = new Setting<>(100);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How far are you allowed to fall onto solid ground (without a water bucket)?
|
||||||
|
* 3 won't deal any damage. But if you just want to get down the mountain quickly and you have
|
||||||
|
* Feather Falling IV, you might set it a bit higher, like 4 or 5.
|
||||||
|
*/
|
||||||
|
public Setting<Integer> maxFallHeight = new Setting<>(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pathing can never take longer than this
|
* Pathing can never take longer than this
|
||||||
*/
|
*/
|
||||||
|
@ -38,6 +38,7 @@ public class CalculationContext implements Helper {
|
|||||||
private final boolean canSprint;
|
private final boolean canSprint;
|
||||||
private final double placeBlockCost;
|
private final double placeBlockCost;
|
||||||
private final boolean allowBreak;
|
private final boolean allowBreak;
|
||||||
|
private final int maxFallHeight;
|
||||||
|
|
||||||
public CalculationContext() {
|
public CalculationContext() {
|
||||||
this(new ToolSet());
|
this(new ToolSet());
|
||||||
@ -51,6 +52,7 @@ public class CalculationContext implements Helper {
|
|||||||
this.canSprint = Baritone.settings().allowSprint.get() && player().getFoodStats().getFoodLevel() > 6;
|
this.canSprint = Baritone.settings().allowSprint.get() && player().getFoodStats().getFoodLevel() > 6;
|
||||||
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.get();
|
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.get();
|
||||||
this.allowBreak = Baritone.settings().allowBreak.get();
|
this.allowBreak = Baritone.settings().allowBreak.get();
|
||||||
|
this.maxFallHeight = Baritone.settings().maxFallHeight.get();
|
||||||
// why cache these things here, why not let the movements just get directly from settings?
|
// why cache these things here, why not let the movements just get directly from settings?
|
||||||
// because if some movements are calculated one way and others are calculated another way,
|
// because if some movements are calculated one way and others are calculated another way,
|
||||||
// then you get a wildly inconsistent path that isn't optimal for either scenario.
|
// then you get a wildly inconsistent path that isn't optimal for either scenario.
|
||||||
@ -79,4 +81,8 @@ public class CalculationContext implements Helper {
|
|||||||
public boolean allowBreak() {
|
public boolean allowBreak() {
|
||||||
return allowBreak;
|
return allowBreak;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int maxFallHeight(){
|
||||||
|
return maxFallHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,6 +284,8 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
for (int fallHeight = 3; true; fallHeight++) {
|
for (int fallHeight = 3; true; fallHeight++) {
|
||||||
BlockPos onto = dest.down(fallHeight);
|
BlockPos onto = dest.down(fallHeight);
|
||||||
if (onto.getY() < 0) {
|
if (onto.getY() < 0) {
|
||||||
|
// when pathing in the end, where you could plausibly fall into the void
|
||||||
|
// this check prevents it from getting the block at y=-1 and crashing
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
IBlockState ontoBlock = BlockStateInterface.get(onto);
|
IBlockState ontoBlock = BlockStateInterface.get(onto);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package baritone.bot.pathing.movement.movements;
|
package baritone.bot.pathing.movement.movements;
|
||||||
|
|
||||||
|
import baritone.bot.Baritone;
|
||||||
import baritone.bot.behavior.impl.LookBehaviorUtils;
|
import baritone.bot.behavior.impl.LookBehaviorUtils;
|
||||||
import baritone.bot.pathing.movement.CalculationContext;
|
import baritone.bot.pathing.movement.CalculationContext;
|
||||||
import baritone.bot.pathing.movement.Movement;
|
import baritone.bot.pathing.movement.Movement;
|
||||||
@ -51,7 +52,7 @@ public class MovementFall extends Movement {
|
|||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
double placeBucketCost = 0.0;
|
double placeBucketCost = 0.0;
|
||||||
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > 3) {
|
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > context.maxFallHeight()) {
|
||||||
if (!context.hasWaterBucket()) {
|
if (!context.hasWaterBucket()) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
@ -88,7 +89,7 @@ public class MovementFall extends Movement {
|
|||||||
}
|
}
|
||||||
BlockPos playerFeet = playerFeet();
|
BlockPos playerFeet = playerFeet();
|
||||||
Optional<Rotation> targetRotation = Optional.empty();
|
Optional<Rotation> targetRotation = Optional.empty();
|
||||||
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > 3 && !playerFeet.equals(dest)) {
|
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > Baritone.settings().maxFallHeight.get() && !playerFeet.equals(dest)) {
|
||||||
if (!player().inventory.hasItemStack(STACK_BUCKET_WATER) || world().provider.isNether()) { // TODO check if water bucket is on hotbar or main inventory
|
if (!player().inventory.hasItemStack(STACK_BUCKET_WATER) || world().provider.isNether()) { // TODO check if water bucket is on hotbar or main inventory
|
||||||
state.setStatus(MovementStatus.UNREACHABLE);
|
state.setStatus(MovementStatus.UNREACHABLE);
|
||||||
return state;
|
return state;
|
||||||
|
@ -83,7 +83,7 @@ public class MovementTraverse extends Movement {
|
|||||||
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MovementHelper.canWalkThrough(positionsToBreak[0]) && MovementHelper.canWalkThrough(positionsToBreak[1])) {
|
if (MovementHelper.canWalkThrough(positionsToBreak[0], pb0) && MovementHelper.canWalkThrough(positionsToBreak[1], pb1)) {
|
||||||
if (WC == WALK_ONE_BLOCK_COST && context.canSprint()) {
|
if (WC == WALK_ONE_BLOCK_COST && context.canSprint()) {
|
||||||
// if there's nothing in the way, and this isn't water or soul sand, and we aren't sneak placing
|
// if there's nothing in the way, and this isn't water or soul sand, and we aren't sneak placing
|
||||||
// we can sprint =D
|
// we can sprint =D
|
||||||
|
Loading…
Reference in New Issue
Block a user