Skip to content

Commit 26e0af1

Browse files
committed
Merge branch '1.20.5' into 1.21.1
2 parents aff430a + 42bb441 commit 26e0af1

File tree

8 files changed

+21
-11
lines changed

8 files changed

+21
-11
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ public final class Settings {
185185
* <p>
186186
* Defaults to false because this fails on constantiam. Please let me know if this is ever disabled. Please.
187187
*/
188+
public final Setting<Boolean> allowJumpAtBuildLimit = new Setting<>(false);
189+
190+
/**
191+
* Just here so mods that use the API don't break. Does nothing.
192+
*/
193+
@Deprecated
194+
@JavaOnly
188195
public final Setting<Boolean> allowJumpAt256 = new Setting<>(false);
189196

190197
/**

src/api/java/baritone/api/utils/SettingsUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public static void readAndApply(Settings settings, String settingsName) {
8383

8484
String settingName = matcher.group("setting").toLowerCase();
8585
String settingValue = matcher.group("value");
86+
// TODO remove soonish
87+
if ("allowjumpat256".equals(settingName)) {
88+
settingName = "allowjumpatbuildlimit";
89+
}
8690
try {
8791
parseAndApply(settings, settingName, settingValue);
8892
} catch (Exception ex) {

src/main/java/baritone/command/defaults/RenderCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public void execute(String label, IArgConsumer args) throws CommandException {
4040
int renderDistance = (ctx.minecraft().options.renderDistance().get() + 1) * 16;
4141
ctx.minecraft().levelRenderer.setBlocksDirty(
4242
origin.x - renderDistance,
43-
0,
43+
ctx.world().getMinBuildHeight(),
4444
origin.z - renderDistance,
4545
origin.x + renderDistance,
46-
255,
46+
ctx.world().getMaxBuildHeight(),
4747
origin.z + renderDistance
4848
);
4949
logDirect("Done");

src/main/java/baritone/command/defaults/TunnelCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void execute(String label, IArgConsumer args) throws CommandException {
4444
int width = Integer.parseInt(args.getArgs().get(1).getValue());
4545
int depth = Integer.parseInt(args.getArgs().get(2).getValue());
4646

47-
if (width < 1 || height < 2 || depth < 1 || height > 255) {
47+
if (width < 1 || height < 2 || depth < 1 || height > ctx.world().getMaxBuildHeight()){
4848
logDirect("Width and depth must at least be 1 block; Height must at least be 2 blocks, and cannot be greater than the build limit.");
4949
cont = false;
5050
}

src/main/java/baritone/pathing/movement/CalculationContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class CalculationContext {
6666
public final List<Block> allowBreakAnyway;
6767
public final boolean allowParkour;
6868
public final boolean allowParkourPlace;
69-
public final boolean allowJumpAt256;
69+
public final boolean allowJumpAtBuildLimit;
7070
public final boolean allowParkourAscend;
7171
public final boolean assumeWalkOnWater;
7272
public boolean allowFallIntoLava;
@@ -107,7 +107,7 @@ public CalculationContext(IBaritone baritone, boolean forUseOnAnotherThread) {
107107
this.allowBreakAnyway = new ArrayList<>(Baritone.settings().allowBreakAnyway.value);
108108
this.allowParkour = Baritone.settings().allowParkour.value;
109109
this.allowParkourPlace = Baritone.settings().allowParkourPlace.value;
110-
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value;
110+
this.allowJumpAtBuildLimit = Baritone.settings().allowJumpAtBuildLimit.value;
111111
this.allowParkourAscend = Baritone.settings().allowParkourAscend.value;
112112
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value;
113113
this.allowFallIntoLava = false; // Super secret internal setting for ElytraBehavior

src/main/java/baritone/pathing/movement/movements/MovementDescend.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ public static boolean dynamicFallCost(CalculationContext context, int x, int y,
147147
int effectiveStartHeight = y;
148148
for (int fallHeight = 3; true; fallHeight++) {
149149
int newY = y - fallHeight;
150-
if (newY < 0) {
150+
if (newY < context.world.getMinBuildHeight()) {
151151
// when pathing in the end, where you could plausibly fall into the void
152-
// this check prevents it from getting the block at y=-1 and crashing
152+
// this check prevents it from getting the block at y=(below whatever the minimum height is) and crashing
153153
return false;
154154
}
155155
boolean reachedMinimum = fallHeight >= context.minFallHeight;

src/main/java/baritone/pathing/movement/movements/MovementParkour.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ public static void cost(CalculationContext context, int x, int y, int z, Directi
6464
if (!context.allowParkour) {
6565
return;
6666
}
67-
if (y == 256 && !context.allowJumpAt256) {
67+
if (!context.allowJumpAtBuildLimit && y >= context.world.getMaxBuildHeight()) {
6868
return;
6969
}
70-
7170
int xDiff = dir.getStepX();
7271
int zDiff = dir.getStepZ();
7372
if (!MovementHelper.fullyPassable(context, x + xDiff, y, z + zDiff)) {

src/main/java/baritone/utils/BlockStateInterfaceAccessWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ public FluidState getFluidState(BlockPos blockPos) {
5656

5757
@Override
5858
public int getHeight() {
59-
return 255;
59+
return bsi.world.getHeight();
6060
}
6161

6262
@Override
6363
public int getMinBuildHeight() {
64-
return 0;
64+
return bsi.world.getMinBuildHeight();
6565
}
6666

6767
}

0 commit comments

Comments
 (0)