Skip to content

Commit

Permalink
jumpboost merge
Browse files Browse the repository at this point in the history
  • Loading branch information
onixiya1337 committed Dec 11, 2023
1 parent b48d803 commit e1ce2c8
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 15 deletions.
Binary file modified dist/baritone-api-1.0.0.jar
Binary file not shown.
Binary file modified dist/baritone-api-forge-1.0.0.jar
Binary file not shown.
Binary file modified dist/baritone-deobf-1.0.0.jar
Binary file not shown.
Binary file modified dist/baritone-standalone-1.0.0.jar
Binary file not shown.
Binary file modified dist/baritone-standalone-forge-1.0.0.jar
Binary file not shown.
Binary file modified dist/baritone-unoptimized-1.0.0.jar
Binary file not shown.
12 changes: 6 additions & 6 deletions dist/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
31fc2d21299b9927dcb38fc3dbd90d59299e807c baritone-api-1.0.0.jar
9f9b5145da7718c40eacca3b20eb16e88bf3b8d8 baritone-deobf-1.0.0.jar
4b3dbbba15cde281fbfcaaa8621975e187b1fa87 baritone-api-forge-1.0.0.jar
4cc961276a8fcb2df23f212f663f8b993e54ae16 baritone-standalone-1.0.0.jar
51ca80011da7d6cbe96e36ed4cd3bafbe18f9066 baritone-standalone-forge-1.0.0.jar
6d19f3d441c81115902c94b1f1f23bf8eb478afd baritone-unoptimized-1.0.0.jar
4f3fd20536237c1eb9a9a06c7bcf969549c440b3 baritone-api-1.0.0.jar
1b1c000e8f7700ae1b9a2ab4be1154c31e183ee5 baritone-deobf-1.0.0.jar
d2f6e0d539c6b596b18d40487105f829ead46ae9 baritone-api-forge-1.0.0.jar
e3bad20dc8473e080700ac83b976378f4c276ebb baritone-standalone-1.0.0.jar
bc477ce6bca72430dc2609ae6d474c1dcb2c7250 baritone-standalone-forge-1.0.0.jar
99d91516bcc96a9f99fad38553d1d4cab2396902 baritone-unoptimized-1.0.0.jar
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import baritone.pathing.movement.MovementState;
import baritone.utils.BlockStateInterface;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;

Expand Down Expand Up @@ -104,23 +104,29 @@ public MovementState updateState(MovementState state) {
return state;
}

boolean isInJumpBoost = ctx.player().getActivePotionEffect(Potion.jump).getAmplifier() > 0 && !ctx.player().onGround;

if (ctx.playerFeet().equals(dest) || ctx.playerFeet().equals(dest.add(getDirection().down()))) {
return state.setStatus(MovementStatus.SUCCESS);
if (!isInJumpBoost) {
return state.setStatus(MovementStatus.SUCCESS);
}
}

Vec3 destCenter = VecUtils.getBlockPosCenter(dest).subtract(0, 0.5, 0);
Rotation target = RotationUtils.calcRotationFromVec3d(ctx.playerHead(),
destCenter,
ctx.playerRotations()).withPitch(ctx.playerRotations().getPitch());

state.setTarget(new MovementState.MovementTarget(target, false));
if (!isInJumpBoost) {
state.setTarget(new MovementState.MovementTarget(target, false));
}

Rotation nextRotation = baritone.getLookBehavior().getAimProcessor().interpolate(ctx.playerRotations(), target);
float deltaYaw = nextRotation.subtract(target).normalize().getYaw();
if (Math.abs(deltaYaw) <= Baritone.settings().randomLooking.value + Baritone.settings().randomLooking113.value + Baritone.settings().maxYawOffsetForForward.value) {
state.setInput(Input.MOVE_FORWARD, true);
} else {
MovementHelper.setInputsAccurate(ctx, state, VecUtils.getBlockPosCenter(src).addVector(getDirection().getX() * 0.4, 0, getDirection().getZ() * 0.4));
MovementHelper.setInputsAccurate(ctx, state, VecUtils.getBlockPosCenter(src).addVector(getDirection().getX() * 0.42, 0, getDirection().getZ() * 0.42));
}
//TODO: Move towards dest

Expand Down
14 changes: 9 additions & 5 deletions src/main/java/baritone/pathing/path/PathExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
import baritone.pathing.movement.Movement;
import baritone.pathing.movement.MovementHelper;
import baritone.pathing.movement.movements.*;
import baritone.utils.BlockStateInterface;
import baritone.utils.InputOverrideHandler;
import net.minecraft.block.state.IBlockState;
import net.minecraft.potion.Potion;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Tuple;
import net.minecraft.util.Vec3;
Expand Down Expand Up @@ -87,7 +85,10 @@ public boolean onTick() {
}
}
Tuple<Double, BlockPos> status = closestPathPos(path);
if (possiblyOffPath(status, BaritoneAPI.getSettings().maxDistFromPath.value)) {

boolean isInJumpBoost = ctx.player().getActivePotionEffect(Potion.jump).getAmplifier() > 0 && !ctx.player().onGround;

if (!isInJumpBoost && possiblyOffPath(status, BaritoneAPI.getSettings().maxDistFromPath.value)) {
ticksAway++;
System.out.println("FAR AWAY FROM PATH FOR " + ticksAway + " TICKS. Current distance: " + status.getFirst() + ". Threshold: " + BaritoneAPI.getSettings().maxDistFromPath.value);
if (ticksAway > MAX_TICKS_AWAY) {
Expand All @@ -98,7 +99,7 @@ public boolean onTick() {
} else {
ticksAway = 0;
}
if (possiblyOffPath(status, BaritoneAPI.getSettings().maxMaxDistFromPath.value)) {
if (!isInJumpBoost && possiblyOffPath(status, BaritoneAPI.getSettings().maxDistFromPath.value)) {
logDebug("too far from path");
cancel();
return false;
Expand Down Expand Up @@ -494,6 +495,9 @@ private static boolean sprintableAscend(IPlayerContext ctx, MovementTraverse cur
if (!Baritone.settings().sprintAscends.value) {
return false;
}
if (ctx.player().getActivePotionEffect(Potion.jump).getAmplifier() > 0) {
return false;
}
if (!current.getDirection().equals(next.getDirection().down())) {
return false;
}
Expand Down

0 comments on commit e1ce2c8

Please sign in to comment.