* Rename schematicaOnlyBuildSelection to buildOnlySelection
* Make it useable with #build as well
* remove debugging code I forgot
This commit is contained in:
ZacSharp 2021-04-14 23:36:16 +02:00
parent c13cf4f29c
commit 46066d4cac
No known key found for this signature in database
GPG Key ID: 9453647B005083A3
3 changed files with 12 additions and 8 deletions

View File

@ -848,9 +848,9 @@ public final class Settings {
public final Setting<Boolean> skipFailedLayers = new Setting<>(false);
/**
* Only build the selected part of the schematic when using #schematica
* Only build the selected part of schematics
*/
public final Setting<Boolean> schematicaOnlyBuildSelection = new Setting<>(false);
public final Setting<Boolean> buildOnlySelection = 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

View File

@ -141,6 +141,11 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
parsed = new MapArtSchematic((IStaticSchematic) parsed);
}
if (Baritone.settings().buildOnlySelection.value) {
parsed = new SelectionSchematic(parsed, origin, baritone.getSelectionManager().getSelections());
}
build(name, parsed, origin);
return true;
}
@ -153,7 +158,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
IStaticSchematic s = schematic.get().getFirst();
BlockPos origin = schematic.get().getSecond();
ISchematic schem = Baritone.settings().mapArtMode.value ? new MapArtSchematic(s) : s;
schem = Baritone.settings().schematicaOnlyBuildSelection.value ? new SelectionSchematic(schem, origin, baritone.getSelectionManager().getSelections()) : schem;
if (Baritone.settings().buildOnlySelection.value) {
schem = new SelectionSchematic(schem, origin, baritone.getSelectionManager().getSelections());
}
this.build(
schematic.get().getFirst().toString(),
schem,

View File

@ -22,7 +22,7 @@ import baritone.api.schematic.MaskSchematic;
import baritone.api.selection.ISelection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import java.util.stream.Stream;
@ -30,17 +30,14 @@ public class SelectionSchematic extends MaskSchematic {
private final ISelection[] selections;
public SelectionSchematic(ISchematic schematic, BlockPos origin, ISelection[] selections) {
public SelectionSchematic(ISchematic schematic, Vec3i origin, ISelection[] selections) {
super(schematic);
baritone.api.utils.Helper.HELPER.logDirect(String.format("%s", selections[0].min()));
this.selections = Stream.of(selections).map(
sel -> sel
.shift(EnumFacing.WEST, origin.getX())
.shift(EnumFacing.DOWN, origin.getY())
.shift(EnumFacing.NORTH, origin.getZ()))
.toArray(ISelection[]::new);
baritone.api.utils.Helper.HELPER.logDirect(String.format("%s", this.selections[0].min()));
baritone.api.utils.Helper.HELPER.logDirect(String.format("%s", origin));
}
@Override