fixes to parkour place

This commit is contained in:
Leijurv 2018-09-14 08:40:34 -07:00
parent 6b45b84784
commit d7a646789e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 18 additions and 1 deletions

View File

@ -104,6 +104,11 @@ public class Settings {
*/
public Setting<Boolean> allowParkour = new Setting<>(false);
/**
* Like parkour, but even more unreliable!
*/
public Setting<Boolean> allowParkourPlace = new Setting<>(false);
/**
* For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly.
*/

View File

@ -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()) {