Skip to content

Commit f9d563b

Browse files
authored
Merge pull request #3819 from ZacSharp/1.17.1-update
Merge 1.16.5 into 1.17.1
2 parents 2453a4a + 3e3312f commit f9d563b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+718
-305
lines changed

.github/workflows/gradle_build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1717
- name: Set up JDK 16
18-
uses: actions/setup-java@v2
18+
uses: actions/setup-java@v3
1919
with:
2020
java-version: '16'
21-
distribution: 'adopt'
21+
distribution: 'temurin'
2222

2323
- name: Grant execute permission for gradlew
2424
run: chmod +x gradlew
@@ -33,13 +33,13 @@ jobs:
3333
run: ./gradlew build -Pbaritone.forge_build -Ploom.platform=forge
3434

3535
- name: Archive Artifacts
36-
uses: actions/upload-artifact@v2
36+
uses: actions/upload-artifact@v3
3737
with:
3838
name: Artifacts
3939
path: dist/
4040

4141
- name: Archive mapping.txt
42-
uses: actions/upload-artifact@v2
42+
uses: actions/upload-artifact@v3
4343
with:
4444
name: Mappings
4545
path: build/tmp/proguard/mapping.txt

.github/workflows/run_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
- name: Set up JDK 16
16-
uses: actions/setup-java@v2
16+
uses: actions/setup-java@v3
1717
with:
1818
java-version: '16'
19-
distribution: 'adopt'
19+
distribution: 'temurin'
2020

2121
- name: Grant execute permission for gradlew
2222
run: chmod +x gradlew

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ Baritone is the pathfinding system used in [Impact](https://impactclient.net/) s
5454

5555
[Tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa)
5656

57-
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). **For 1.12.2 Forge, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.15/baritone-api-forge-1.2.15.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
57+
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to
58+
install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). **For 1.12.2 Forge, just click
59+
[here](https://github.com/cabaletta/baritone/releases/download/v1.2.17/baritone-api-forge-1.2.17.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
5860

5961
For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge or Fabric 1.16.5, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.3) and get the `api-forge` or `api-fabric` jar. **For 1.16.5 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.6.3/baritone-api-fabric-1.6.3.jar)**.
6062

buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ private void generateConfigs() throws Exception {
237237

238238
// Setup the template that will be used to derive the API and Standalone configs
239239
List<String> template = Files.readAllLines(getTemporaryFile(PROGUARD_CONFIG_DEST));
240-
template.add(0, "-injars " + this.artifactPath.toString());
241-
template.add(1, "-outjars " + this.getTemporaryFile(PROGUARD_EXPORT_PATH));
240+
template.add(0, "-injars '" + this.artifactPath.toString() + "'");
241+
template.add(1, "-outjars '" + this.getTemporaryFile(PROGUARD_EXPORT_PATH) + "'");
242242

243243
template.add(2, "-libraryjars <java.home>/jmods/java.base.jmod(!**.jar;!module-info.class)");
244244
template.add(3, "-libraryjars <java.home>/jmods/java.desktop.jmod(!**.jar;!module-info.class)");
@@ -312,9 +312,15 @@ private void runProguard(Path config) throws Exception {
312312
Files.delete(this.proguardOut);
313313
}
314314

315-
Path proguardJar = getTemporaryFile(PROGUARD_JAR);
315+
// Make paths relative to work directory; fixes spaces in path to config, @"" doesn't work
316+
Path workingDirectory = getTemporaryFile("");
317+
Path proguardJar = workingDirectory.relativize(getTemporaryFile(PROGUARD_JAR));
318+
config = workingDirectory.relativize(config);
319+
320+
// Honestly, if you still have spaces in your path at this point, you're SOL.
321+
316322
Process p = new ProcessBuilder("java", "-jar", proguardJar.toString(), "@" + config.toString())
317-
.directory(getTemporaryFile("").toFile()) // Set the working directory to the temporary folder]
323+
.directory(workingDirectory.toFile()) // Set the working directory to the temporary folder]
318324
.start();
319325

320326
// We can't do output inherit process I/O with gradle for some reason and have it work, so we have to do this

src/api/java/baritone/api/Settings.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
import java.lang.reflect.Type;
3636
import java.util.*;
3737
import java.util.List;
38-
import java.util.function.Consumer;
3938
import java.util.function.BiConsumer;
39+
import java.util.function.Consumer;
4040

4141
/**
4242
* Baritone's settings. Settings apply to all Baritone instances.
@@ -108,6 +108,13 @@ public final class Settings {
108108
*/
109109
public final Setting<Double> walkOnWaterOnePenalty = new Setting<>(3D);
110110

111+
/**
112+
* Don't allow breaking blocks next to liquids.
113+
* <p>
114+
* Enable if you have mods adding custom fluid physics.
115+
*/
116+
public final Setting<Boolean> strictLiquidCheck = new Setting<>(false);
117+
111118
/**
112119
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
113120
* Reliability: questionable.
@@ -117,6 +124,8 @@ public final class Settings {
117124
/**
118125
* Allow Baritone to assume it can walk on still water just like any other block.
119126
* This functionality is assumed to be provided by a separate library that might have imported Baritone.
127+
* <p>
128+
* Note: This will prevent some usage of the frostwalker enchantment, like pillaring up from water.
120129
*/
121130
public final Setting<Boolean> assumeWalkOnWater = new Setting<>(false);
122131

@@ -197,7 +206,7 @@ public final class Settings {
197206
* Blocks that Baritone is not allowed to break
198207
*/
199208
public final Setting<List<Block>> blocksToDisallowBreaking = new Setting<>(new ArrayList<>(
200-
// Leave Empty by Default
209+
// Leave Empty by Default
201210
));
202211

203212
/**
@@ -277,6 +286,12 @@ public final class Settings {
277286
*/
278287
public final Setting<Boolean> buildIgnoreDirection = new Setting<>(false);
279288

289+
/**
290+
* A list of names of block properties the builder will ignore.
291+
*/
292+
public final Setting<List<String>> buildIgnoreProperties = new Setting<>(new ArrayList<>(Arrays.asList(
293+
)));
294+
280295
/**
281296
* If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block.
282297
* <p>
@@ -916,7 +931,7 @@ public final class Settings {
916931
/**
917932
* Only build the selected part of schematics
918933
*/
919-
public final Setting<Boolean> buildOnlySelection = new Setting<>(false);
934+
public final Setting<Boolean> buildOnlySelection = new Setting<>(false);
920935

921936
/**
922937
* How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely

src/api/java/baritone/api/command/datatypes/RelativeCoordinate.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

2727
public enum RelativeCoordinate implements IDatatypePost<Double, Double> {
2828
INSTANCE;
29-
private static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)([k-k]?)|)$");
29+
private static String ScalesAliasRegex = "[kKmM]";
30+
private static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(" + ScalesAliasRegex + "?)|)$");
3031

3132
@Override
3233
public Double apply(IDatatypeContext ctx, Double origin) throws CommandException {
@@ -41,11 +42,15 @@ public Double apply(IDatatypeContext ctx, Double origin) throws CommandException
4142

4243
boolean isRelative = !matcher.group(1).isEmpty();
4344

44-
double offset = matcher.group(2).isEmpty() ? 0 : Double.parseDouble(matcher.group(2).replaceAll("k", ""));
45+
double offset = matcher.group(2).isEmpty() ? 0 : Double.parseDouble(matcher.group(2).replaceAll(ScalesAliasRegex, ""));
4546

46-
if (matcher.group(2).contains("k")) {
47+
if (matcher.group(2).toLowerCase().contains("k")) {
4748
offset *= 1000;
4849
}
50+
if (matcher.group(2).toLowerCase().contains("m")) {
51+
offset *= 1000000;
52+
}
53+
4954

5055
if (isRelative) {
5156
return origin + offset;

src/api/java/baritone/api/command/datatypes/RelativeFile.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public static Stream<String> tabComplete(IArgConsumer consumer, File base0) thro
8383
boolean useParent = !currentPathStringThing.isEmpty() && !currentPathStringThing.endsWith(File.separator);
8484
File currentFile = currentPath.isAbsolute() ? currentPath.toFile() : new File(base, currentPathStringThing);
8585
return Stream.of(Objects.requireNonNull(getCanonicalFileUnchecked(
86-
useParent
87-
? currentFile.getParentFile()
88-
: currentFile
89-
).listFiles()))
86+
useParent
87+
? currentFile.getParentFile()
88+
: currentFile
89+
).listFiles()))
9090
.map(f -> (currentPath.isAbsolute() ? f : basePath.relativize(f.toPath()).toString()) +
9191
(f.isDirectory() ? File.separator : ""))
9292
.filter(s -> s.toLowerCase(Locale.US).startsWith(currentPathStringThing.toLowerCase(Locale.US)))

src/api/java/baritone/api/command/registry/Registry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public boolean register(V entry) {
8484
* @param entry The entry to unregister.
8585
*/
8686
public void unregister(V entry) {
87-
if (registered(entry)) {
87+
if (!registered(entry)) {
8888
return;
8989
}
9090
_entries.remove(entry);

src/api/java/baritone/api/pathing/goals/GoalNear.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
import baritone.api.utils.SettingsUtil;
2121
import baritone.api.utils.interfaces.IGoalRenderPos;
22-
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
2322
import it.unimi.dsi.fastutil.doubles.DoubleIterator;
23+
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
2424
import net.minecraft.core.BlockPos;
2525

2626
public class GoalNear implements Goal, IGoalRenderPos {

src/api/java/baritone/api/pathing/goals/GoalRunAway.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
package baritone.api.pathing.goals;
1919

2020
import baritone.api.utils.SettingsUtil;
21-
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
2221
import it.unimi.dsi.fastutil.doubles.DoubleIterator;
23-
import java.util.Arrays;
22+
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
2423
import net.minecraft.core.BlockPos;
2524

25+
import java.util.Arrays;
26+
2627
/**
2728
* Useful for automated combat (retreating specifically)
2829
*

0 commit comments

Comments
 (0)