this seems to work as well?

This commit is contained in:
Entropy5 2023-01-12 04:29:31 +01:00
parent 98a87d099b
commit 16a62625b3
1 changed files with 6 additions and 7 deletions

View File

@ -95,6 +95,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
this.name = name; this.name = name;
this.schematic = schematic; this.schematic = schematic;
this.realSchematic = null; this.realSchematic = null;
boolean buildingSelectionSchematic = schematic instanceof SelectionSchematic;
if (!Baritone.settings().buildSubstitutes.value.isEmpty()) { if (!Baritone.settings().buildSubstitutes.value.isEmpty()) {
this.schematic = new SubstituteSchematic(this.schematic, Baritone.settings().buildSubstitutes.value); this.schematic = new SubstituteSchematic(this.schematic, Baritone.settings().buildSubstitutes.value);
} }
@ -114,7 +115,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
this.paused = false; this.paused = false;
this.layer = Baritone.settings().startAtLayer.value; this.layer = Baritone.settings().startAtLayer.value;
this.stopAtHeight = schematic.heightY(); this.stopAtHeight = schematic.heightY();
if (Baritone.settings().buildOnlySelection.value) { if (Baritone.settings().buildOnlySelection.value && buildingSelectionSchematic) { // currently redundant but safer maybe
if (baritone.getSelectionManager().getSelections().length == 0) { if (baritone.getSelectionManager().getSelections().length == 0) {
logDirect("Poor little kitten forgot to set a selection while BuildOnlySelection is true"); logDirect("Poor little kitten forgot to set a selection while BuildOnlySelection is true");
this.stopAtHeight = 0; this.stopAtHeight = 0;
@ -124,12 +125,10 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (minim.isPresent() && maxim.isPresent()) { if (minim.isPresent() && maxim.isPresent()) {
int startAtHeight = Baritone.settings().layerOrder.value ? y + schematic.heightY() - maxim.getAsInt() : minim.getAsInt() - y; int startAtHeight = Baritone.settings().layerOrder.value ? y + schematic.heightY() - maxim.getAsInt() : minim.getAsInt() - y;
this.stopAtHeight = (Baritone.settings().layerOrder.value ? y + schematic.heightY() - minim.getAsInt() : maxim.getAsInt() - y) + 1; this.stopAtHeight = (Baritone.settings().layerOrder.value ? y + schematic.heightY() - minim.getAsInt() : maxim.getAsInt() - y) + 1;
this.layer = startAtHeight / Baritone.settings().layerHeight.value; this.layer = Math.max(this.layer, startAtHeight / Baritone.settings().layerHeight.value); // startAtLayer or startAtHeight, whichever is highest
if (Baritone.settings().chatDebug.value) { logDebug(String.format("Schematic starts at y=%s with height %s", y, schematic.heightY()));
logDirect(String.format("Schematic starts at y=%s with height %s", y, schematic.heightY())); logDebug(String.format("Selection starts at y=%s and ends at y=%s", minim.getAsInt(), maxim.getAsInt()));
logDirect(String.format("Selection starts at y=%s and ends at y=%s", minim.getAsInt(), maxim.getAsInt())); logDebug(String.format("Considering relevant height %s - %s", startAtHeight, this.stopAtHeight));
logDirect(String.format("Considering relevant height %s - %s", startAtHeight, this.stopAtHeight));
}
} }
} }
} }