Skip to content

Commit 920c3aa

Browse files
committed
Merge branch 'master' into 1.19.4
2 parents e8bcd05 + f2679be commit 920c3aa

2 files changed

Lines changed: 22 additions & 12 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Warning: Old Branch!!
2+
3+
**Click [here](https://github.com/cabaletta/baritone) to go to the current Baritone readme.**
4+
5+
**This branch (`master`) is Baritone for Minecraft 1.12.2. This is the original version of Minecraft that Baritone was written for, and it was the primary development branch for over 5 years. As such, it's quite mature, and arguably more reliable than Baritone for newer versions of Minecraft. Nevertheless, as of August 2023, with [2b2t's update from 1.12.2 to 1.19.4](https://2b2t.org/update/), I decided to move Baritone's primary development branch accordingly. PRs should now be made against the `1.19.4` branch going forward. This branch might see some fixes going forward, particularly to newer features such as `#elytra`, but it won't be the primary focus anymore.**
6+
7+
The other intermediary branches (`1.13.2`, `1.14.4`, `1.15.2`, `1.16.5`, `1.17.1`, `1.18.2`, `1.19.2`, and `1.19.3`) will probably not receive any updates at all. You can find their last releases in the releases tab, or in the quick download links table.
8+
9+
For `1.16.5` and `1.18.2`, the latest release is fully up to date with the code. ZacSharp merged master into some of those versions even after they were deprecated, if you are for some reason really interested in the latest Baritone bugfixes on these versions of Minecraft, you can build from source as of these commits: [1.13.2](https://github.com/cabaletta/baritone/commit/be54b8ee5b5639f80e3d6809ed1abd52444d8a08), [1.14.4](https://github.com/cabaletta/baritone/commit/be54b8ee5b5639f80e3d6809ed1abd52444d8a08), [1.15.2](https://github.com/cabaletta/baritone/commit/45abbb7fa1062cefc26abbb006a02a4edd6faa32), [1.17.1](https://github.com/cabaletta/baritone/commit/cbf0d79c9c5f7454071dc0a5289261ec9ca4373f), [1.19.2](https://github.com/cabaletta/baritone/commit/217dca53633610edc9483fda7a234e46c839fd99). For `1.19.3`, merging [this](https://github.com/cabaletta/baritone/commit/217dca53633610edc9483fda7a234e46c839fd99) commit into it is trivial and is left as an exercise for the reader. For other versions in between these (for example people always ask in the Discord for 1.16.1), you'll have to figure it out yourself.
10+
111
# Baritone
212
<p align="center">
313
<a href="https://github.com/cabaletta/baritone/releases/"><img src="https://img.shields.io/github/downloads/cabaletta/baritone/total.svg" alt="GitHub All Releases"/></a>

src/main/java/baritone/process/elytra/ElytraBehavior.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public final class ElytraBehavior implements Helper {
102102

103103
private BlockStateInterface bsi;
104104
private final BlockStateOctreeInterface boi;
105-
public final BlockPos destination;
105+
public final BetterBlockPos destination;
106106
private final boolean appendDestination;
107107

108108
private final ExecutorService solverExecutor;
@@ -123,7 +123,7 @@ public ElytraBehavior(Baritone baritone, ElytraProcess process, BlockPos destina
123123
this.blockedLines = new CopyOnWriteArrayList<>();
124124
this.pathManager = this.new PathManager();
125125
this.process = process;
126-
this.destination = destination;
126+
this.destination = new BetterBlockPos(destination);
127127
this.appendDestination = appendDestination;
128128
this.solverExecutor = Executors.newSingleThreadExecutor();
129129
this.nextTickBoostCounter = new int[2];
@@ -192,16 +192,16 @@ public CompletableFuture<Void> pathToDestination(final BlockPos from) {
192192
});
193193
}
194194

195-
public CompletableFuture<Void> pathRecalcSegment(final int upToIncl) {
195+
public CompletableFuture<Void> pathRecalcSegment(final OptionalInt upToIncl) {
196196
if (this.recalculating) {
197197
throw new IllegalStateException("already recalculating");
198198
}
199199

200200
this.recalculating = true;
201-
final List<BetterBlockPos> after = this.path.subList(upToIncl + 1, this.path.size());
201+
final List<BetterBlockPos> after = upToIncl.isPresent() ? this.path.subList(upToIncl.getAsInt() + 1, this.path.size()) : Collections.emptyList();
202202
final boolean complete = this.completePath;
203203

204-
return this.path0(ctx.playerFeet(), this.path.get(upToIncl), segment -> segment.append(after.stream(), complete))
204+
return this.path0(ctx.playerFeet(), upToIncl.isPresent() ? this.path.get(upToIncl.getAsInt()) : ElytraBehavior.this.destination, segment -> segment.append(after.stream(), complete || (segment.isFinished() && !upToIncl.isPresent())))
205205
.whenComplete((result, ex) -> {
206206
this.recalculating = false;
207207
if (ex != null) {
@@ -319,7 +319,7 @@ private void pathfindAroundObstacles() {
319319
}
320320

321321
if (ElytraBehavior.this.process.state != ElytraProcess.State.LANDING && this.ticksNearUnchanged > 100) {
322-
this.pathRecalcSegment(rangeEndExcl - 1)
322+
this.pathRecalcSegment(OptionalInt.of(rangeEndExcl - 1))
323323
.thenRun(() -> {
324324
logDirect("Recalculating segment, no progress in last 100 ticks");
325325
});
@@ -335,15 +335,15 @@ private void pathfindAroundObstacles() {
335335
if (!ElytraBehavior.this.clearView(this.path.getVec(i), this.path.getVec(i + 1), false)) {
336336
// obstacle. where do we return to pathing?
337337
// if the end of render distance is closer to goal, then that's fine, otherwise we'd be "digging our hole deeper" and making an already bad backtrack worse
338-
int rejoinMainPathAt;
339-
if (this.path.get(rangeEndExcl - 1).distanceSq(this.path.get(path.size() - 1)) < ctx.playerFeet().distanceSq(this.path.get(path.size() - 1))) {
340-
rejoinMainPathAt = rangeEndExcl - 1; // rejoin after current render distance
338+
OptionalInt rejoinMainPathAt;
339+
if (this.path.get(rangeEndExcl - 1).distanceSq(ElytraBehavior.this.destination) < ctx.playerFeet().distanceSq(ElytraBehavior.this.destination)) {
340+
rejoinMainPathAt = OptionalInt.of(rangeEndExcl - 1); // rejoin after current render distance
341341
} else {
342-
rejoinMainPathAt = path.size() - 1; // large backtrack detected. ignore render distance, rejoin later on
342+
rejoinMainPathAt = OptionalInt.empty(); // large backtrack detected. ignore render distance, rejoin later on
343343
}
344344

345345
final BetterBlockPos blockage = this.path.get(i);
346-
final double distance = ctx.playerFeet().distanceTo(this.path.get(rejoinMainPathAt));
346+
final double distance = ctx.playerFeet().distanceTo(this.path.get(rejoinMainPathAt.orElse(path.size() - 1)));
347347

348348
final long start = System.nanoTime();
349349
this.pathRecalcSegment(rejoinMainPathAt)
@@ -360,7 +360,7 @@ private void pathfindAroundObstacles() {
360360
}
361361
}
362362
if (!canSeeAny && rangeStartIncl < rangeEndExcl - 2 && process.state != ElytraProcess.State.GET_TO_JUMP) {
363-
this.pathRecalcSegment(rangeEndExcl - 1).thenRun(() -> logDirect("Recalculated segment since no path points were visible"));
363+
this.pathRecalcSegment(OptionalInt.of(rangeEndExcl - 1)).thenRun(() -> logDirect("Recalculated segment since no path points were visible"));
364364
}
365365
}
366366

0 commit comments

Comments
 (0)