From 46066d4cacc4d3076b95699dc2ea261bc04a34d4 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Wed, 14 Apr 2021 23:36:16 +0200 Subject: [PATCH] Misc * Rename schematicaOnlyBuildSelection to buildOnlySelection * Make it useable with #build as well * remove debugging code I forgot --- src/api/java/baritone/api/Settings.java | 4 ++-- src/main/java/baritone/process/BuilderProcess.java | 9 ++++++++- .../baritone/utils/schematic/SelectionSchematic.java | 7 ++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 3756b0ee..3481200c 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -848,9 +848,9 @@ public final class Settings { public final Setting 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 schematicaOnlyBuildSelection = new Setting<>(false); + public final Setting 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 diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index b9f1c27c..cf5c0193 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -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, diff --git a/src/main/java/baritone/utils/schematic/SelectionSchematic.java b/src/main/java/baritone/utils/schematic/SelectionSchematic.java index 81a381a3..243a3d4d 100644 --- a/src/main/java/baritone/utils/schematic/SelectionSchematic.java +++ b/src/main/java/baritone/utils/schematic/SelectionSchematic.java @@ -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