build in layers order

This commit is contained in:
Leijurv 2019-05-14 16:03:11 -07:00
parent b2f3880722
commit da58988f01
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 24 additions and 1 deletions

View File

@ -664,6 +664,13 @@ public final class Settings {
*/ */
public final Setting<Boolean> buildInLayers = new Setting<>(false); public final Setting<Boolean> buildInLayers = new Setting<>(false);
/**
* false = build from bottom to top
* <p>
* true = build from top to bottom
*/
public final Setting<Boolean> layerOrder = new Setting<>(false);
/** /**
* How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely * How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely
*/ */

View File

@ -302,12 +302,28 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro
realSchematic = schematic; realSchematic = schematic;
} }
ISchematic realSchematic = this.realSchematic; // wrap this properly, dont just have the inner class refer to the builderprocess.this ISchematic realSchematic = this.realSchematic; // wrap this properly, dont just have the inner class refer to the builderprocess.this
int minYInclusive;
int maxYInclusive;
// layer = 0 should be nothing
// layer = realSchematic.heightY() should be everything
if (Baritone.settings().layerOrder.value) { // top to bottom
maxYInclusive = realSchematic.heightY() - 1;
minYInclusive = realSchematic.heightY() - layer;
} else {
maxYInclusive = layer - 1;
minYInclusive = 0;
}
schematic = new ISchematic() { schematic = new ISchematic() {
@Override @Override
public IBlockState desiredState(int x, int y, int z) { public IBlockState desiredState(int x, int y, int z) {
return realSchematic.desiredState(x, y, z); return realSchematic.desiredState(x, y, z);
} }
@Override
public boolean inSchematic(int x, int y, int z) {
return ISchematic.super.inSchematic(x, y, z) && y >= minYInclusive && y <= maxYInclusive;
}
@Override @Override
public int widthX() { public int widthX() {
return realSchematic.widthX(); return realSchematic.widthX();
@ -315,7 +331,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro
@Override @Override
public int heightY() { public int heightY() {
return layer; return realSchematic.heightY();
} }
@Override @Override