Skip to content

Commit 50df7b2

Browse files
authored
Merge pull request cabaletta#4677 from ZacSharp/pr/1.19.4/misc/backportCurrentLayerAndMenuLinks
Backport cabaletta#4634 and cabaletta#4205 to 1.19.4
2 parents 9de3074 + 92130f1 commit 50df7b2

3 files changed

Lines changed: 39 additions & 1 deletion

File tree

fabric/src/main/resources/fabric.mod.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
],
1212
"contact": {
1313
"homepage": "https://github.com/cabaletta/baritone",
14-
"sources": "https://github.com/cabaletta/baritone"
14+
"sources": "https://github.com/cabaletta/baritone",
15+
"issues": "https://github.com/cabaletta/baritone/issues"
1516
},
1617

1718
"license": "LGPL-3.0",
@@ -27,5 +28,12 @@
2728
"depends": {
2829
"fabricloader": ">=0.11.0",
2930
"minecraft": "1.19.4"
31+
},
32+
"custom": {
33+
"modmenu": {
34+
"links": {
35+
"modmenu.discord": "https://discord.gg/s6fRBAUpmr"
36+
}
37+
}
3038
}
3139
}

src/api/java/baritone/api/process/IBuilderProcess.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import net.minecraft.world.level.block.state.BlockState;
2525
import java.io.File;
2626
import java.util.List;
27+
import java.util.Optional;
2728

2829
/**
2930
* @author Brady
@@ -74,4 +75,17 @@ default boolean build(String schematicFile, BlockPos origin) {
7475
* cause it to give up. This is updated every tick, but only while the builder process is active.
7576
*/
7677
List<BlockState> getApproxPlaceable();
78+
/**
79+
* Returns the lower bound of the current mining layer if mineInLayers is true.
80+
* If mineInLayers is false, this will return an empty optional.
81+
* @return The lower bound of the current mining layer
82+
*/
83+
Optional<Integer> getMinLayer();
84+
85+
/**
86+
* Returns the upper bound of the current mining layer if mineInLayers is true.
87+
* If mineInLayers is false, this will return an empty optional.
88+
* @return The upper bound of the current mining layer
89+
*/
90+
Optional<Integer> getMaxLayer();
7791
}

src/main/java/baritone/process/BuilderProcess.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,22 @@ public String displayName0() {
999999
return paused ? "Builder Paused" : "Building " + name;
10001000
}
10011001

1002+
@Override
1003+
public Optional<Integer> getMinLayer() {
1004+
if (Baritone.settings().buildInLayers.value) {
1005+
return Optional.of(this.layer);
1006+
}
1007+
return Optional.empty();
1008+
}
1009+
1010+
@Override
1011+
public Optional<Integer> getMaxLayer() {
1012+
if (Baritone.settings().buildInLayers.value) {
1013+
return Optional.of(this.stopAtHeight);
1014+
}
1015+
return Optional.empty();
1016+
}
1017+
10021018
private List<BlockState> approxPlaceable(int size) {
10031019
List<BlockState> result = new ArrayList<>();
10041020
for (int i = 0; i < size; i++) {

0 commit comments

Comments
 (0)