add forceAllowBreak setting
This commit is contained in:
parent
8c2aae2ddc
commit
4e6b6d97ce
@ -49,6 +49,11 @@ public final class Settings {
|
||||
*/
|
||||
public final Setting<Boolean> allowBreak = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Blocks that baritone will be allowed to break even with allowBreak set to false
|
||||
*/
|
||||
public final Setting<List<Block>> forceAllowBreak = new Setting<>(new ArrayList<>());
|
||||
|
||||
/**
|
||||
* Allow Baritone to sprint
|
||||
*/
|
||||
|
@ -34,6 +34,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static baritone.api.pathing.movement.ActionCosts.COST_INF;
|
||||
|
||||
/**
|
||||
@ -55,6 +58,7 @@ public class CalculationContext {
|
||||
public final boolean canSprint;
|
||||
protected final double placeBlockCost; // protected because you should call the function instead
|
||||
public final boolean allowBreak;
|
||||
public final List<Block> forceAllowBreak;
|
||||
public final boolean allowParkour;
|
||||
public final boolean allowParkourPlace;
|
||||
public final boolean allowJumpAt256;
|
||||
@ -89,6 +93,7 @@ public class CalculationContext {
|
||||
this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6;
|
||||
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
|
||||
this.allowBreak = Baritone.settings().allowBreak.value;
|
||||
this.forceAllowBreak = new ArrayList<>(Baritone.settings().forceAllowBreak.value);
|
||||
this.allowParkour = Baritone.settings().allowParkour.value;
|
||||
this.allowParkourPlace = Baritone.settings().allowParkourPlace.value;
|
||||
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value;
|
||||
@ -150,7 +155,9 @@ public class CalculationContext {
|
||||
|
||||
public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) {
|
||||
if (!allowBreak) {
|
||||
return COST_INF;
|
||||
if (!forceAllowBreak.contains(current.getBlock())) {
|
||||
return COST_INF;
|
||||
}
|
||||
}
|
||||
if (isPossiblyProtected(x, y, z)) {
|
||||
return COST_INF;
|
||||
|
@ -947,7 +947,12 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
|
||||
@Override
|
||||
public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) {
|
||||
if (!allowBreak || isPossiblyProtected(x, y, z)) {
|
||||
if (!allowBreak) {
|
||||
if (!forceAllowBreak.contains(current.getBlock())) {
|
||||
return COST_INF;
|
||||
}
|
||||
}
|
||||
if (isPossiblyProtected(x, y, z)) {
|
||||
return COST_INF;
|
||||
}
|
||||
IBlockState sch = getSchematic(x, y, z, current);
|
||||
|
Loading…
Reference in New Issue
Block a user