Skip to content

Commit 5c2b706

Browse files
committed
Merge branch '1.21.1' into 1.21.3
2 parents 9d5db72 + ae82f26 commit 5c2b706

Some content is hidden

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

41 files changed

+449
-103
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.19.2-brightgreen.svg" alt="Minecraft"/></a>
1515
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.19.4-brightgreen.svg" alt="Minecraft"/></a>
1616
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.20.1-brightgreen.svg" alt="Minecraft"/></a>
17+
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.21.3-brightgreen.svg" alt="Minecraft"/></a>
1718
</p>
1819

1920
<p align="center">
@@ -70,6 +71,7 @@ Baritone is the pathfinding system used in [Impact](https://impactclient.net/) s
7071
| [1.20.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-forge-1.10.1.jar) | [1.20.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-fabric-1.10.1.jar) |
7172
| [1.20.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-forge-1.10.2.jar) | [1.20.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-fabric-1.10.2.jar) |
7273
| [1.20.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-forge-1.10.2.jar) | [1.20.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-fabric-1.10.2.jar) |
74+
| [1.21.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-forge-1.11.1.jar) | [1.21.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-fabric-1.11.1.jar) |
7375

7476
**Message for 2b2t players looking for 1.19/1.20 Baritone** If you like, please try the beta for Baritone Elytra for 2b2t, find it in #announcements of [the Baritone discord](http://discord.gg/s6fRBAUpmr). It supports 1.19.4 and 1.20.1, Forge or Fabric. If you have to see it to believe it, watch [this YouTube video](https://youtu.be/NnSlQi-68eQ).
7577

SETUP.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,87 @@
11
# Installation
22

3-
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone.
4-
5-
You can also use a custom version json for Minecraft, with the [1.14.4](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1) version or the [1.15.2](https://www.dropbox.com/s/8rx6f0kts9hvd4f/1.15.2-Baritone.zip?dl=1) version or the [1.16.5](https://www.dropbox.com/s/i6f292o2i7o9acp/1.16.5-Baritone.zip?dl=1) version.
3+
The easiest way to install Baritone is to install it as Forge/Neoforge/Fabric mod, but if you know how you can also use with a custom `version.json`
4+
(Examples: [1.14.4](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1), [1.15.2](https://www.dropbox.com/s/8rx6f0kts9hvd4f/1.15.2-Baritone.zip?dl=1), [1.16.5](https://www.dropbox.com/s/i6f292o2i7o9acp/1.16.5-Baritone.zip?dl=1)).
65

76
Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
87

98
## Prebuilt official releases
10-
These releases are not always completely up to date with latest features, and are only released from `master`. (so if you want `backfill-2` branch for example, you'll have to build it yourself)
9+
Releases are made rarely and are not always up to date with the latest features and bug fixes.
1110

1211
Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases)
1312

14-
v1.2.* is for 1.12.2, v1.3.* is for 1.13.2, v1.4.* is for 1.14.4, v1.5.* is for 1.15.2, v1.6.* is for 1.16.5, v1.7.* is for 1.17.1, v1.8.* is for 1.18.1
13+
The mapping between major Minecraft versions and major Baritone versions is as follows
14+
| Minecraft version | 1.12 | 1.13 | 1.14 | 1.15 | 1.16 | 1.17 | 1.18 | 1.19 | 1.20 | 1.21 |
15+
|-------------------|------|------|------|------|------|------|------|------|-------|-------|
16+
| Baritone version | v1.2 | v1.3 | v1.4 | v1.5 | v1.6 | v1.7 | v1.8 | v1.9 | v1.10 | v1.11 |
1517

1618
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by that public keys of `checksums.txt`.
1719

18-
The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
20+
The build is fully deterministic and reproducible, and you can verify that by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
1921

2022

2123
## Artifacts
2224

23-
Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases).
25+
Building Baritone will create the final artifacts in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases).
2426

25-
**The Forge and Fabric releases can simply be added as a Forge/Fabric mods.**
27+
**The Forge, NeoForge and Fabric releases can simply be added as a Forge/Neoforge/Fabric mods.**
2628

27-
If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar`
29+
If another one of your other mods has a Baritone integration, you want `baritone-api-*-VERSION.jar`.
30+
If you want to report a bug and spare us some effort, you want `baritone-unoptimized-*-VERSION.jar`.
31+
Otherwise, you want `baritone-standalone-*-VERSION.jar`
2832

33+
Here's what the various qualifiers mean
2934
- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features.
30-
- **Forge/Fabric API**: Same as API, but packaged for Forge/Fabric. This should be used where another mod has a Baritone integration.
31-
- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features.
32-
- **Forge/Fabric Standalone**: Same as Standalone, but packaged for Forge/Fabric. This should be used when Baritone is your only Forge/Fabric mod, or none of your other Forge/Fabric mods integrate with Baritone.
33-
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production.
34-
- **Forge/Fabric Unoptimized**: Same as Unoptimized, but packaged for Forge/Fabric.
35+
- **Standalone**: Everything is obfuscated. Other mods cannot use Baritone, but you get a bit of extra performance.
36+
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used in production, but is really helpful for crash reports.
37+
38+
- **No loader**: Loadable as a launchwrapper tweaker against vanilla Minecraft using a custom `version.json`.
39+
- **Forge/Neoforge/Fabric**: Loadable as a standard mod using the respective loader. The fabric build may or may not work on Quilt.
40+
41+
If you build from source you will also find mapping files in the `dist` directory. These contain the renamings done by ProGuard and are useful if you want to read obfuscated stack traces.
3542

3643
## Build it yourself
3744
- Clone or download Baritone
3845

3946
![Image](https://i.imgur.com/kbqBtoN.png)
40-
- If you choose to download, make sure you extract the ZIP archive.
47+
- If you choose to download, make sure you download the correct branch and extract the ZIP archive.
4148
- Follow one of the instruction sets below, based on your preference
4249

4350
## Command Line
4451
On Mac OSX and Linux, use `./gradlew` instead of `gradlew`.
4552

46-
If you have errors with a package missing please make sure you have setup your environment, and are using Oracle JDK 8 for 1.12.2-1.16.5, JDK 16+ for 1.17.1, and JDK 17+ for 1.18.1.
47-
48-
To check which java you are using do
49-
`java -version` in a command prompt or terminal.
50-
If you are using anything above OpenJDK 8 for 1.12.2-1.16.5, it might not work because the Java distributions above JDK 8 using may not have the needed javax classes.
53+
The recommended Java versions by Minecraft version are
54+
| Minecraft version | Java version |
55+
|-------------------------------|---------------|
56+
| 1.12.2 - 1.16.5 | 8 |
57+
| 1.17.1 | 16 |
58+
| 1.18.2 - 1.20.4 | 17 |
59+
| 1.20.5 - 1.21.4 | 21 |
5160

5261
Download java: https://adoptium.net/
53-
#### macOS guide
54-
In order to get JDK 8, Try running the following command:
55-
`% /usr/libexec/java_home -V`
56-
If it doesn't work try this guide: https://stackoverflow.com/questions/46513639/how-to-downgrade-java-from-9-to-8-on-a-macos-eclipse-is-not-running-with-java-9
57-
58-
If you see something like
59-
60-
`% 1.8.0_VERSION, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_VERSION.jdk/Contents/Home`
6162

62-
in the list then you've got JDK 8 installed.
63-
In order to get JDK 8 running in the **current terminal window** you will have to run this command:
64-
65-
`% export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)`
66-
67-
To add OpenJDK 8 to your PATH add the export line to the end of your `.zshrc / .bashrc` if you want it to apply to each new terminal. If you're using bash change the .bachrc and if you're using zsh change the .zshrc
63+
To check which java version you are using do `java -version` in a command prompt or terminal.
6864

6965
### Building Baritone
7066

7167
These tasks depend on the minecraft version, but are (for the most part) standard for building mods.
7268

73-
for more details, see [the build ci action](/.github/workflows/gradle_build.yml)
69+
For more details, see [the build ci action](/.github/workflows/gradle_build.yml) of the branch you want to build.
70+
71+
For most branches `gradlew build` should build everything, but there are exceptions and this file might be out of date.
72+
73+
More specifically, on older branches the setup used to be that `gradlew build` builds the tweaker jar
74+
and `gradlew build -Pbaritone.forge_build` / `gradlew build -Pbaritone.fabric_build` are needed to build
75+
for Forge/Fabric instead. And you might have to run `setupDecompWorkspace` first.
7476

7577
## IntelliJ
7678
- Open the project in IntelliJ as a Gradle project
7779
- Refresh the Gradle project (or, to be safe, just restart IntelliJ)
78-
- depending on the minecraft version, you may need to run `setupDecompWorkspace` or `genIntellijRuns` in order to get everything working
80+
- Depending on the minecraft version, you may need to run `setupDecompWorkspace` or `genIntellijRuns` in order to get everything working
81+
82+
## Github Actions
83+
Most branches have a CI workflow at `.github/workflows/gradle_build.yml`. If you fork this repository and enable actions for your fork
84+
you can push a dummy commit to trigger it and have GitHub build Baritone for you.
85+
86+
If the commit you want to build is less than 90 days old, you can also find the corresponding workflow run in
87+
[this list](https://github.com/cabaletta/baritone/actions/workflows/gradle_build.yml) and download the artifacts from there.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ allprojects {
3838
group = rootProject.maven_group
3939

4040
sourceCompatibility = targetCompatibility = JavaVersion.toVersion(project.java_version)
41-
41+
4242
java {
4343
toolchain {
4444
languageVersion.set(JavaLanguageVersion.of(sourceCompatibility.majorVersion.toInteger()))

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

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

1617
"license": "LGPL-3.0",
@@ -26,5 +27,12 @@
2627
"depends": {
2728
"fabricloader": ">=0.14.22",
2829
"minecraft": ["1.21.2","1.21.3"]
30+
},
31+
"custom": {
32+
"modmenu": {
33+
"links": {
34+
"modmenu.discord": "https://discord.gg/s6fRBAUpmr"
35+
}
36+
}
2937
}
3038
}

scripts/proguard.pro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
-dontwarn baritone.utils.schematic.schematica.**
5555
-dontwarn baritone.utils.schematic.litematica.**
5656

57+
# nether-pathfinder uses JNI to acess its own classes
58+
# and some of our builds include it before running proguard
59+
# conservatively keep all of it, even though only PathSegment.<init> is needed
60+
-keep,allowoptimization class dev.babbaj.pathfinder.** { *; }
61+
5762
# Keep - Applications. Keep all application classes, along with their 'main'
5863
# methods.
5964
-keepclasseswithmembers public class * {

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ public final class Settings {
7777
*/
7878
public final Setting<Boolean> allowPlace = new Setting<>(true);
7979

80+
/**
81+
* Allow Baritone to place blocks in fluid source blocks
82+
*/
83+
public final Setting<Boolean> allowPlaceInFluidsSource = new Setting<>(true);
84+
85+
/**
86+
* Allow Baritone to place blocks in flowing fluid
87+
*/
88+
public final Setting<Boolean> allowPlaceInFluidsFlow = new Setting<>(true);
89+
8090
/**
8191
* Allow Baritone to move items in your inventory to your hotbar
8292
*/
@@ -1218,6 +1228,11 @@ public final class Settings {
12181228
*/
12191229
public final Setting<Integer> followRadius = new Setting<>(3);
12201230

1231+
/**
1232+
* The maximum distance to the entity you're following
1233+
*/
1234+
public final Setting<Integer> followTargetMaxDistance = new Setting<>(0);
1235+
12211236
/**
12221237
* Turn this on if your exploration filter is enormous, you don't want it to check if it's done,
12231238
* and you are just fine with it just hanging on completion

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,11 @@
2323
import net.minecraft.resources.ResourceLocation;
2424
import net.minecraft.world.level.block.Block;
2525

26-
import java.util.regex.Pattern;
2726
import java.util.stream.Stream;
2827

2928
public enum BlockById implements IDatatypeFor<Block> {
3029
INSTANCE;
3130

32-
/**
33-
* Matches (domain:)?name? where domain and name are [a-z0-9_.-]+ and [a-z0-9/_.-]+ respectively.
34-
*/
35-
private static Pattern PATTERN = Pattern.compile("(?:[a-z0-9_.-]+:)?[a-z0-9/_.-]*");
36-
3731
@Override
3832
public Block get(IDatatypeContext ctx) throws CommandException {
3933
ResourceLocation id = ResourceLocation.parse(ctx.getConsumer().getString());
@@ -48,10 +42,6 @@ public Block get(IDatatypeContext ctx) throws CommandException {
4842
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
4943
String arg = ctx.getConsumer().getString();
5044

51-
if (!PATTERN.matcher(arg).matches()) {
52-
return Stream.empty();
53-
}
54-
5545
return new TabCompleteHelper()
5646
.append(
5747
BuiltInRegistries.BLOCK.keySet()
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This file is part of Baritone.
3+
*
4+
* Baritone is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* Baritone is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
package baritone.api.command.datatypes;
19+
20+
import baritone.api.command.exception.CommandException;
21+
import baritone.api.command.helpers.TabCompleteHelper;
22+
import net.minecraft.core.registries.BuiltInRegistries;
23+
import net.minecraft.resources.ResourceLocation;
24+
import net.minecraft.world.item.Item;
25+
26+
import java.util.stream.Stream;
27+
28+
public enum ItemById implements IDatatypeFor<Item> {
29+
INSTANCE;
30+
31+
@Override
32+
public Item get(IDatatypeContext ctx) throws CommandException {
33+
ResourceLocation id = ResourceLocation.parse(ctx.getConsumer().getString());
34+
Item item;
35+
if ((item = BuiltInRegistries.ITEM.getOptional(id).orElse(null)) == null) {
36+
throw new IllegalArgumentException("No item found by that id");
37+
}
38+
return item;
39+
}
40+
41+
@Override
42+
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
43+
return new TabCompleteHelper()
44+
.append(
45+
BuiltInRegistries.BLOCK.keySet()
46+
.stream()
47+
.map(ResourceLocation::toString)
48+
)
49+
.filterPrefixNamespaced(ctx.getConsumer().getString())
50+
.sortAlphabetically()
51+
.stream();
52+
}
53+
}

src/api/java/baritone/api/command/helpers/TabCompleteHelper.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ public TabCompleteHelper filterPrefix(String prefix) {
212212
* @return This {@link TabCompleteHelper}
213213
*/
214214
public TabCompleteHelper filterPrefixNamespaced(String prefix) {
215-
return filterPrefix(ResourceLocation.parse(prefix).toString());
215+
ResourceLocation loc = ResourceLocation.tryParse(prefix);
216+
if (loc == null) {
217+
stream = Stream.empty();
218+
return this;
219+
}
220+
return filterPrefix(loc.toString());
216221
}
217222

218223
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public GoalRunAway(double distance, BlockPos... from) {
4444

4545
public GoalRunAway(double distance, Integer maintainY, BlockPos... from) {
4646
if (from.length == 0) {
47-
throw new IllegalArgumentException();
47+
throw new IllegalArgumentException("Positions to run away from must not be empty");
4848
}
4949
this.from = from;
5050
this.distanceSq = (int) (distance * distance);

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/api/java/baritone/api/process/IFollowProcess.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
package baritone.api.process;
1919

20+
import net.minecraft.world.entity.Entity;
21+
import net.minecraft.world.item.ItemStack;
22+
2023
import java.util.List;
2124
import java.util.function.Predicate;
22-
import net.minecraft.world.entity.Entity;
2325

2426
/**
2527
* @author Brady
@@ -34,6 +36,13 @@ public interface IFollowProcess extends IBaritoneProcess {
3436
*/
3537
void follow(Predicate<Entity> filter);
3638

39+
/**
40+
* Try to pick up any items matching this predicate
41+
*
42+
* @param filter the predicate
43+
*/
44+
void pickup(Predicate<ItemStack> filter);
45+
3746
/**
3847
* @return The entities that are currently being followed. null if not currently following, empty if nothing matches the predicate
3948
*/

src/api/java/baritone/api/schematic/ISchematicSystem.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import baritone.api.schematic.format.ISchematicFormat;
2222

2323
import java.io.File;
24+
import java.util.List;
2425
import java.util.Optional;
2526

2627
/**
@@ -41,4 +42,9 @@ public interface ISchematicSystem {
4142
* @return The corresponding format for the file, {@link Optional#empty()} if no candidates were found.
4243
*/
4344
Optional<ISchematicFormat> getByFile(File file);
45+
46+
/**
47+
* @return A list of file extensions used by supported formats
48+
*/
49+
List<String> getFileExtensions();
4450
}

0 commit comments

Comments
 (0)