max fall height even with bucket, fixes #57
This commit is contained in:
parent
4c0d581d7f
commit
9f12a0ab6f
@ -133,7 +133,13 @@ public class Settings {
|
|||||||
* 3 won't deal any damage. But if you just want to get down the mountain quickly and you have
|
* 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.
|
* Feather Falling IV, you might set it a bit higher, like 4 or 5.
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> maxFallHeight = new Setting<>(3);
|
public Setting<Integer> maxFallHeightNoWater = new Setting<>(3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How far are you allowed to fall onto solid ground (with a water bucket)?
|
||||||
|
* It's not that reliable, so I've set it below what would kill an unarmored player (23)
|
||||||
|
*/
|
||||||
|
public Setting<Integer> maxFallHeightBucket = new Setting<>(20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If your goal is a GoalBlock in an unloaded chunk, assume it's far enough away that the Y coord
|
* If your goal is a GoalBlock in an unloaded chunk, assume it's far enough away that the Y coord
|
||||||
|
@ -38,7 +38,8 @@ 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;
|
private final int maxFallHeightNoWater;
|
||||||
|
private final int maxFallHeightBucket;
|
||||||
|
|
||||||
public CalculationContext() {
|
public CalculationContext() {
|
||||||
this(new ToolSet());
|
this(new ToolSet());
|
||||||
@ -52,7 +53,8 @@ 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();
|
this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.get();
|
||||||
|
this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.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.
|
||||||
@ -82,7 +84,12 @@ public class CalculationContext implements Helper {
|
|||||||
return allowBreak;
|
return allowBreak;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int maxFallHeight(){
|
public int maxFallHeightNoWater() {
|
||||||
return maxFallHeight;
|
return maxFallHeightNoWater;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int maxFallHeightBucket() {
|
||||||
|
return maxFallHeightBucket;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (canWalkOn(onto, ontoBlock)) {
|
if (canWalkOn(onto, ontoBlock)) {
|
||||||
if (calcContext.hasWaterBucket() || fallHeight <= 4) {
|
if ((calcContext.hasWaterBucket() && fallHeight <= calcContext.maxFallHeightBucket() + 1) || fallHeight <= calcContext.maxFallHeightNoWater() + 1) {
|
||||||
// fallHeight = 4 means onto.up() is 3 blocks down, which is the max
|
// fallHeight = 4 means onto.up() is 3 blocks down, which is the max
|
||||||
return new MovementFall(pos, onto.up());
|
return new MovementFall(pos, onto.up());
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,10 +52,13 @@ 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() > context.maxFallHeight()) {
|
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > context.maxFallHeightNoWater()) {
|
||||||
if (!context.hasWaterBucket()) {
|
if (!context.hasWaterBucket()) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
|
if (src.getY() - dest.getY() > context.maxFallHeightBucket()) {
|
||||||
|
return COST_INF;
|
||||||
|
}
|
||||||
placeBucketCost = context.placeBlockCost();
|
placeBucketCost = context.placeBlockCost();
|
||||||
}
|
}
|
||||||
double frontTwo = MovementHelper.getMiningDurationTicks(context, positionsToBreak[0]) + MovementHelper.getMiningDurationTicks(context, positionsToBreak[1]);
|
double frontTwo = MovementHelper.getMiningDurationTicks(context, positionsToBreak[0]) + MovementHelper.getMiningDurationTicks(context, positionsToBreak[1]);
|
||||||
@ -89,7 +92,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() > Baritone.settings().maxFallHeight.get() && !playerFeet.equals(dest)) {
|
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > Baritone.settings().maxFallHeightNoWater.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;
|
||||||
|
Loading…
Reference in New Issue
Block a user