add jump penalty
This commit is contained in:
parent
d41aa5f9ae
commit
77938a77e8
@ -68,6 +68,11 @@ public class Settings {
|
||||
*/
|
||||
public Setting<Double> blockBreakAdditionalPenalty = new Setting<>(2D);
|
||||
|
||||
/**
|
||||
* Additional penalty for hitting the space bar (ascend, pillar, or parkour) beacuse it uses hunger
|
||||
*/
|
||||
public Setting<Double> jumpPenalty = new Setting<>(2D);
|
||||
|
||||
/**
|
||||
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
|
||||
* Reliability: questionable.
|
||||
|
@ -61,6 +61,7 @@ public class CalculationContext {
|
||||
private final int maxFallHeightBucket;
|
||||
private final double waterWalkSpeed;
|
||||
private final double breakBlockAdditionalCost;
|
||||
private final double jumpPenalty;
|
||||
private final BetterWorldBorder worldBorder;
|
||||
|
||||
public CalculationContext(IBaritone baritone) {
|
||||
@ -93,6 +94,7 @@ public class CalculationContext {
|
||||
float mult = depth / 3.0F;
|
||||
this.waterWalkSpeed = ActionCosts.WALK_ONE_IN_WATER_COST * (1 - mult) + ActionCosts.WALK_ONE_BLOCK_COST * mult;
|
||||
this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.get();
|
||||
this.jumpPenalty = Baritone.settings().jumpPenalty.get();
|
||||
// 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,
|
||||
// then you get a wildly inconsistent path that isn't optimal for either scenario.
|
||||
@ -212,4 +214,8 @@ public class CalculationContext {
|
||||
public double breakBlockAdditionalCost() {
|
||||
return breakBlockAdditionalCost;
|
||||
}
|
||||
|
||||
public double jumpPenalty() {
|
||||
return jumpPenalty;
|
||||
}
|
||||
}
|
||||
|
@ -115,15 +115,18 @@ public class MovementAscend extends Movement {
|
||||
if (jumpingToBottomSlab) {
|
||||
if (jumpingFromBottomSlab) {
|
||||
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST); // we hit space immediately on entering this action
|
||||
walk += context.jumpPenalty();
|
||||
} else {
|
||||
walk = WALK_ONE_BLOCK_COST; // we don't hit space we just walk into the slab
|
||||
}
|
||||
} else {
|
||||
// jumpingFromBottomSlab must be false
|
||||
if (toPlace.getBlock() == Blocks.SOUL_SAND) {
|
||||
walk = WALK_ONE_OVER_SOUL_SAND_COST;
|
||||
} else {
|
||||
walk = WALK_ONE_BLOCK_COST;
|
||||
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST);
|
||||
}
|
||||
walk += context.jumpPenalty();
|
||||
}
|
||||
|
||||
// cracks knuckles
|
||||
|
@ -115,7 +115,7 @@ public class MovementParkour extends Movement {
|
||||
res.x = x + xDiff * i;
|
||||
res.y = y;
|
||||
res.z = z + zDiff * i;
|
||||
res.cost = costFromJumpDistance(i);
|
||||
res.cost = costFromJumpDistance(i) + context.jumpPenalty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ public class MovementParkour extends Movement {
|
||||
res.x = destX;
|
||||
res.y = y;
|
||||
res.z = destZ;
|
||||
res.cost = costFromJumpDistance(4) + context.placeBlockCost();
|
||||
res.cost = costFromJumpDistance(4) + context.placeBlockCost() + context.jumpPenalty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class MovementPillar extends Movement {
|
||||
if (ladder) {
|
||||
return LADDER_UP_ONE_COST + hardness * 5;
|
||||
} else {
|
||||
return JUMP_ONE_BLOCK_COST + context.placeBlockCost() + hardness;
|
||||
return JUMP_ONE_BLOCK_COST + context.placeBlockCost() + context.jumpPenalty() + hardness;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user