Merge pull request #2833 from ZacSharp/layerHeight

 Add layerHeight setting
This commit is contained in:
Leijurv 2021-07-16 18:47:15 -07:00 committed by GitHub
commit 6ff7ae800a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -850,6 +850,11 @@ public final class Settings {
*/
public final Setting<Boolean> layerOrder = new Setting<>(false);
/**
* How high should the individual layers be?
*/
public final Setting<Integer> layerHeight = new Setting<>(1);
/**
* Start building the schematic at a specific layer.
* Can help on larger builds when schematic wants to break things its already built

View File

@ -385,9 +385,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
// layer = realSchematic.heightY() should be everything
if (Baritone.settings().layerOrder.value) { // top to bottom
maxYInclusive = realSchematic.heightY() - 1;
minYInclusive = realSchematic.heightY() - layer;
minYInclusive = realSchematic.heightY() - layer * Baritone.settings().layerHeight.value;
} else {
maxYInclusive = layer - 1;
maxYInclusive = layer * Baritone.settings().layerHeight.value - 1;
minYInclusive = 0;
}
schematic = new ISchematic() {
@ -424,7 +424,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
BuilderCalculationContext bcc = new BuilderCalculationContext();
if (!recalc(bcc)) {
if (Baritone.settings().buildInLayers.value && layer < realSchematic.heightY()) {
if (Baritone.settings().buildInLayers.value && layer * Baritone.settings().layerHeight.value < realSchematic.heightY()) {
logDirect("Starting layer " + layer);
layer++;
return onTick(calcFailed, isSafeToCancel, recursions + 1);
@ -514,7 +514,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (goal == null) {
goal = assemble(bcc, approxPlaceable, true); // we're far away, so assume that we have our whole inventory to recalculate placeable properly
if (goal == null) {
if (Baritone.settings().skipFailedLayers.value && Baritone.settings().buildInLayers.value && layer < realSchematic.heightY()) {
if (Baritone.settings().skipFailedLayers.value && Baritone.settings().buildInLayers.value && layer * Baritone.settings().layerHeight.value < realSchematic.heightY()) {
logDirect("Skipping layer that I cannot construct! Layer #" + layer);
layer++;
return onTick(calcFailed, isSafeToCancel, recursions + 1);