Expose current layer in IBuilderProcess
This commit is contained in:
@@ -24,6 +24,7 @@ import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
@@ -74,4 +75,17 @@ public interface IBuilderProcess extends IBaritoneProcess {
|
||||
* cause it to give up. This is updated every tick, but only while the builder process is active.
|
||||
*/
|
||||
List<BlockState> getApproxPlaceable();
|
||||
/**
|
||||
* Returns the lower bound of the current mining layer if mineInLayers is true.
|
||||
* If mineInLayers is false, this will return an empty optional.
|
||||
* @return The lower bound of the current mining layer
|
||||
*/
|
||||
Optional<Integer> getMinLayer();
|
||||
|
||||
/**
|
||||
* Returns the upper bound of the current mining layer if mineInLayers is true.
|
||||
* If mineInLayers is false, this will return an empty optional.
|
||||
* @return The upper bound of the current mining layer
|
||||
*/
|
||||
Optional<Integer> getMaxLayer();
|
||||
}
|
||||
|
||||
@@ -998,6 +998,22 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
return paused ? "Builder Paused" : "Building " + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Integer> getMinLayer() {
|
||||
if (Baritone.settings().buildInLayers.value) {
|
||||
return Optional.of(this.layer);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Integer> getMaxLayer() {
|
||||
if (Baritone.settings().buildInLayers.value) {
|
||||
return Optional.of(this.stopAtHeight);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
private List<BlockState> approxPlaceable(int size) {
|
||||
List<BlockState> result = new ArrayList<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
||||
Reference in New Issue
Block a user