builder stuff, fixes #1059

This commit is contained in:
Leijurv 2019-12-13 20:09:04 -08:00
parent ddc681fe77
commit 2c3e1f4232
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 24 additions and 1 deletions

View File

@ -184,6 +184,20 @@ public final class Settings {
Blocks.WALL_SIGN
)));
/**
* A list of blocks to be treated as if they're air.
* <p>
* If a schematic asks for air at a certain position, and that position currently contains a block on this list, it will be treated as correct.
*/
public final Setting<List<Block>> buildIgnoreBlocks = new Setting<>(new ArrayList<>(Arrays.asList(
)));
/**
* If this is true, the builder will treat all non-air blocks as correct. It will only place new blocks.
*/
public final Setting<Boolean> buildIgnoreExisting = new Setting<>(true);
/**
* If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block.
* <p>

View File

@ -764,11 +764,20 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
private boolean valid(IBlockState current, IBlockState desired) {
if (desired == null) {
return true;
}
// TODO more complicated comparison logic I guess
if (current.getBlock() instanceof BlockLiquid && Baritone.settings().okIfWater.value) {
return true;
}
return desired == null || current.equals(desired);
if (desired.getBlock() instanceof BlockAir && Baritone.settings().buildIgnoreBlocks.value.contains(current.getBlock())) {
return true;
}
if (!(current.getBlock() instanceof BlockAir) && Baritone.settings().buildIgnoreExisting.value) {
return true;
}
return current.equals(desired);
}
public class BuilderCalculationContext extends CalculationContext {