build repeat vector

This commit is contained in:
Leijurv 2019-05-06 14:01:01 -07:00
parent 482d874af2
commit 1501d721e7
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 13 additions and 16 deletions

View File

@ -23,7 +23,7 @@ import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.text.ITextComponent;
import java.awt.*;
@ -663,14 +663,9 @@ public final class Settings {
public final Setting<Boolean> buildInLayers = new Setting<>(false);
/**
* How far to move before repeating the build. -1 for the size of the build in that axis. 0 to disable
* How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely
*/
public final Setting<Integer> buildRepeatDistance = new Setting<>(0);
/**
* What direction to repeat the build in
*/
public final Setting<EnumFacing> buildRepeatDirection = new Setting<>(EnumFacing.NORTH);
public final Setting<Vec3i> buildRepeat = new Setting<>(new Vec3i(0, 0, 0));
/**
* Allow standing above a block while mining it, in BuilderProcess

View File

@ -21,6 +21,7 @@ import baritone.api.Settings;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3i;
import java.awt.*;
import java.io.BufferedReader;
@ -179,6 +180,11 @@ public class SettingsUtil {
str -> new Color(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])),
color -> color.getRed() + "," + color.getGreen() + "," + color.getBlue()
),
VEC3I(
Vec3i.class,
str -> new Vec3i(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])),
vec -> vec.getX() + "," + vec.getY() + "," + vec.getZ()
),
BLOCK(
Block.class,
str -> BlockUtils.stringToBlockRequired(str.trim()),

View File

@ -330,20 +330,16 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro
layer++;
return onTick(calcFailed, isSafeToCancel);
}
int distance = Baritone.settings().buildRepeatDistance.value;
EnumFacing direction = Baritone.settings().buildRepeatDirection.value;
if (distance == 0) {
Vec3i repeat = Baritone.settings().buildRepeat.value;
if (repeat.equals(new Vec3i(0, 0, 0))) {
logDirect("Done building");
onLostControl();
return null;
}
// build repeat time
if (distance == -1) {
distance = schematic.size(direction.getAxis());
}
layer = 0;
origin = new BlockPos(origin).offset(direction, distance);
logDirect("Repeating build " + distance + " blocks to the " + direction + ", new origin is " + origin);
origin = new BlockPos(origin).add(repeat);
logDirect("Repeating build in vector " + repeat + ", new origin is " + origin);
return onTick(calcFailed, isSafeToCancel);
}
trim(bcc);