Add layerHeight setting

This commit is contained in:
ZacSharp 2021-06-24 23:33:48 +02:00
parent b96795c517
commit ab3a015d61
No known key found for this signature in database
GPG Key ID: 9453647B005083A3
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);