mirror of
https://github.com/cabaletta/baritone
synced 2024-12-18 13:15:13 +00:00
walk on water hunger penalty
This commit is contained in:
parent
02478ee887
commit
ae9ab03e51
@ -73,6 +73,11 @@ public class Settings {
|
||||
*/
|
||||
public Setting<Double> jumpPenalty = new Setting<>(2D);
|
||||
|
||||
/**
|
||||
* Walking on water uses up hunger really quick, so penalize it
|
||||
*/
|
||||
public Setting<Double> walkOnWaterOnePenalty = new Setting<>(5D);
|
||||
|
||||
/**
|
||||
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
|
||||
* Reliability: questionable.
|
||||
|
@ -62,6 +62,7 @@ public class CalculationContext {
|
||||
private final double waterWalkSpeed;
|
||||
private final double breakBlockAdditionalCost;
|
||||
private final double jumpPenalty;
|
||||
private final double walkOnWaterOnePenalty;
|
||||
private final BetterWorldBorder worldBorder;
|
||||
|
||||
public CalculationContext(IBaritone baritone) {
|
||||
@ -95,6 +96,7 @@ public class CalculationContext {
|
||||
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();
|
||||
this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.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.
|
||||
@ -218,4 +220,8 @@ public class CalculationContext {
|
||||
public double jumpPenalty() {
|
||||
return jumpPenalty;
|
||||
}
|
||||
|
||||
public double walkOnWaterOnePenalty() {
|
||||
return walkOnWaterOnePenalty;
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ public class MovementDiagonal extends Movement {
|
||||
// For either possible soul sand, that affects half of our walking
|
||||
if (destWalkOn.getBlock() == Blocks.SOUL_SAND) {
|
||||
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||
} else if (destWalkOn.getBlock() == Blocks.WATER) {
|
||||
multiplier += context.walkOnWaterOnePenalty() * SQRT_2;
|
||||
}
|
||||
Block fromDown = context.get(x, y - 1, z).getBlock();
|
||||
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
|
||||
|
@ -75,6 +75,8 @@ public class MovementTraverse extends Movement {
|
||||
} else {
|
||||
if (destOn.getBlock() == Blocks.SOUL_SAND) {
|
||||
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||
} else if (destOn.getBlock() == Blocks.WATER) {
|
||||
WC += context.walkOnWaterOnePenalty();
|
||||
}
|
||||
if (srcDown == Blocks.SOUL_SAND) {
|
||||
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||
|
Loading…
Reference in New Issue
Block a user