Update build limits (#4736)
* Update minimum build limit * Update MovementDescend.java to work for any minimum height * Update RenderCommand.java for dynamic build heights. * Fix so it actually compiles. * Small syntax change. * Simpler formatting * Fix more height issues. * Remove allowJumpAt256 as redundant. * Remove allowJumpAt256 as redundant. * Update CalculationContext.java * Update Settings.java * Update Settings.java * Deprecate allowJumpAt256. * Re-introduce build limit jump setting. * Update MovementParkour.java * Update CalculationContext.java * Update Settings.java * Update CalculationContext.java * Update src/api/java/baritone/api/Settings.java Co-authored-by: ZacSharp <68165024+ZacSharp@users.noreply.github.com> --------- Co-authored-by: Murat65536 <bob65536@proton.me> Co-authored-by: ZacSharp <68165024+ZacSharp@users.noreply.github.com>
This commit is contained in:
@@ -185,6 +185,13 @@ public final class Settings {
|
||||
* <p>
|
||||
* Defaults to false because this fails on constantiam. Please let me know if this is ever disabled. Please.
|
||||
*/
|
||||
public final Setting<Boolean> allowJumpAtBuildLimit = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* Just here so mods that use the API don't break. Does nothing.
|
||||
*/
|
||||
@Deprecated
|
||||
@JavaOnly
|
||||
public final Setting<Boolean> allowJumpAt256 = new Setting<>(false);
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,10 +40,10 @@ public class RenderCommand extends Command {
|
||||
int renderDistance = (ctx.minecraft().options.renderDistance().get() + 1) * 16;
|
||||
ctx.minecraft().levelRenderer.setBlocksDirty(
|
||||
origin.x - renderDistance,
|
||||
0,
|
||||
ctx.world().getMinBuildHeight(),
|
||||
origin.z - renderDistance,
|
||||
origin.x + renderDistance,
|
||||
255,
|
||||
ctx.world().getMaxBuildHeight(),
|
||||
origin.z + renderDistance
|
||||
);
|
||||
logDirect("Done");
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TunnelCommand extends Command {
|
||||
int width = Integer.parseInt(args.getArgs().get(1).getValue());
|
||||
int depth = Integer.parseInt(args.getArgs().get(2).getValue());
|
||||
|
||||
if (width < 1 || height < 2 || depth < 1 || height > 255) {
|
||||
if (width < 1 || height < 2 || depth < 1 || height > ctx.world().getMaxBuildHeight()){
|
||||
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.");
|
||||
cont = false;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CalculationContext {
|
||||
public final List<Block> allowBreakAnyway;
|
||||
public final boolean allowParkour;
|
||||
public final boolean allowParkourPlace;
|
||||
public final boolean allowJumpAt256;
|
||||
public final boolean allowJumpAtBuildLimit;
|
||||
public final boolean allowParkourAscend;
|
||||
public final boolean assumeWalkOnWater;
|
||||
public boolean allowFallIntoLava;
|
||||
@@ -104,7 +104,7 @@ public class CalculationContext {
|
||||
this.allowBreakAnyway = new ArrayList<>(Baritone.settings().allowBreakAnyway.value);
|
||||
this.allowParkour = Baritone.settings().allowParkour.value;
|
||||
this.allowParkourPlace = Baritone.settings().allowParkourPlace.value;
|
||||
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value;
|
||||
this.allowJumpAtBuildLimit = Baritone.settings().allowJumpAtBuildLimit.value;
|
||||
this.allowParkourAscend = Baritone.settings().allowParkourAscend.value;
|
||||
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value;
|
||||
this.allowFallIntoLava = false; // Super secret internal setting for ElytraBehavior
|
||||
|
||||
@@ -147,9 +147,9 @@ public class MovementDescend extends Movement {
|
||||
int effectiveStartHeight = y;
|
||||
for (int fallHeight = 3; true; fallHeight++) {
|
||||
int newY = y - fallHeight;
|
||||
if (newY < 0) {
|
||||
if (newY < context.world.getMinBuildHeight()) {
|
||||
// when pathing in the end, where you could plausibly fall into the void
|
||||
// this check prevents it from getting the block at y=-1 and crashing
|
||||
// this check prevents it from getting the block at y=(below whatever the minimum height is) and crashing
|
||||
return false;
|
||||
}
|
||||
boolean reachedMinimum = fallHeight >= context.minFallHeight;
|
||||
|
||||
@@ -64,10 +64,9 @@ public class MovementParkour extends Movement {
|
||||
if (!context.allowParkour) {
|
||||
return;
|
||||
}
|
||||
if (y == 256 && !context.allowJumpAt256) {
|
||||
if (!context.allowJumpAtBuildLimit && y >= context.world.getMaxBuildHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int xDiff = dir.getStepX();
|
||||
int zDiff = dir.getStepZ();
|
||||
if (!MovementHelper.fullyPassable(context, x + xDiff, y, z + zDiff)) {
|
||||
|
||||
@@ -56,12 +56,12 @@ public final class BlockStateInterfaceAccessWrapper implements BlockGetter {
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 255;
|
||||
return bsi.world.getMaxBuildHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinBuildHeight() {
|
||||
return 0;
|
||||
return bsi.world.getMinBuildHeight();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user