Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80a8957
Interpolated Looking implementation
TheThouZands Sep 19, 2024
663b3bf
Preserve default look behavior
TheThouZands Jul 7, 2026
2ff5c93
Clean up interpolation style
TheThouZands Jul 7, 2026
9a42997
Sample interpolated rotation arcs
TheThouZands Jul 7, 2026
2290f6c
Track tick arc samples for rendering
TheThouZands Jul 7, 2026
f2892f5
Move rotation arc into rotation utilities
TheThouZands Jul 7, 2026
fd6d57c
Harden rotation arc interpolation
TheThouZands Jul 7, 2026
e001227
Prepare per-frame visual arc sampling
TheThouZands Jul 7, 2026
d97311b
Hook local player camera rotation
TheThouZands Jul 7, 2026
b2c4001
Scale arc duration by angular speed
TheThouZands Jul 7, 2026
4e4ebbe
Restart arcs when player origin moves
TheThouZands Jul 7, 2026
2951eb9
Hold rotation while mining target blocks
TheThouZands Jul 7, 2026
4e0a3b8
Retry mining when held ray drifts
TheThouZands Jul 7, 2026
05cf9b8
Keep mining holds exact
TheThouZands Jul 7, 2026
4251397
Avoid pole-crossing rotation arcs
TheThouZands Jul 7, 2026
6ef8742
Keep interpolated server arcs silent
TheThouZands Jul 7, 2026
1fb8cef
Guard block interactions by reachability
TheThouZands Jul 7, 2026
4a90d17
Drop stale interpolation arcs
TheThouZands Jul 7, 2026
5ff3dc6
Restart arcs when target visibility changes
TheThouZands Jul 7, 2026
71451e0
Pause actions during pause and death
TheThouZands Jul 7, 2026
5a48840
Clean up interpolated look style
TheThouZands Jul 7, 2026
08d0800
Address Codacy feedback
TheThouZands Jul 7, 2026
49c6d4c
Hold builder placement targets
TheThouZands Jul 19, 2026
32f6b8b
Target farm block actions
TheThouZands Jul 19, 2026
8a4ecd9
Target get-to-block right clicks
TheThouZands Jul 19, 2026
dc3fae4
Target movement block interactions
TheThouZands Jul 19, 2026
b7fa572
Keep movement aligned with path rotations
TheThouZands Jul 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,8 @@ public final class Settings {
public final Setting<Boolean> elytraFreeLook = new Setting<>(true);

/**
* Forces the client-sided yaw rotation to an average of the last {@link #smoothLookTicks} of server-sided rotations.
* Forces the client-sided yaw rotation to an average of the last
* {@link #smoothLookTicks} server-sided rotations.
*/
public final Setting<Boolean> smoothLook = new Setting<>(false);

Expand All @@ -789,6 +790,21 @@ public final class Settings {
*/
public final Setting<Integer> smoothLookTicks = new Setting<>(5);

/**
* Interpolates player rotation from the current look direction to the target direction.
* <p>
* This uses {@link #interpolatedLookLength} as a maximum angular speed, so larger
* turns take more ticks than smaller turns.
*/
public final Setting<Boolean> interpolatedLook = new Setting<>(false);

/**
* Maximum angular speed, in degrees per tick, for {@link #interpolatedLook}.
* The historical name is retained for config compatibility.
*/
public final Setting<Integer> interpolatedLookLength = new Setting<>(10);


/**
* When true, the player will remain with its existing look direction as often as possible.
* Although, in some cases this can get it stuck, hence this setting to disable that behavior.
Expand Down
36 changes: 36 additions & 0 deletions src/api/java/baritone/api/behavior/ILookBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,42 @@ public interface ILookBehavior extends IBehavior {
*/
void updateTarget(Rotation rotation, boolean blockInteract);

/**
* Updates the current {@link ILookBehavior} target and optionally restarts
* any active interpolation.
*
* @param rotation The target rotations
* @param blockInteract Whether the target rotations are needed for a block interaction
* @param restartInterpolation Whether active interpolation should restart
* from its current sample
* @see #updateTarget(Rotation, boolean)
*/
default void updateTarget(
Rotation rotation,
boolean blockInteract,
boolean restartInterpolation) {
updateTarget(rotation, blockInteract);
}

/**
* Updates the current {@link ILookBehavior} target and optionally uses it
* without aim processing.
*
* @param rotation The target rotations
* @param blockInteract Whether the target rotations are needed for a block interaction
* @param restartInterpolation Whether active interpolation should restart
* from its current sample
* @param exactRotation Whether the target rotation should skip aim processing
* @see #updateTarget(Rotation, boolean, boolean)
*/
default void updateTarget(
Rotation rotation,
boolean blockInteract,
boolean restartInterpolation,
boolean exactRotation) {
updateTarget(rotation, blockInteract, restartInterpolation);
}

/**
* The aim processor instance for this {@link ILookBehavior}, which is responsible for applying additional,
* deterministic transformations to the target rotation set by {@link #updateTarget}.
Expand Down
14 changes: 14 additions & 0 deletions src/api/java/baritone/api/utils/IInputOverrideHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import baritone.api.behavior.IBehavior;
import baritone.api.utils.input.Input;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

/**
* @author Brady
Expand All @@ -31,4 +33,16 @@ public interface IInputOverrideHandler extends IBehavior {
void setInputForceState(Input input, boolean forced);

void clearAllKeys();

default boolean isBreakingBlock(BlockPos pos) {
return false;
}

default void setBlockBreakTarget(BlockPos pos) {
// Optional hook for handlers that support targeted block breaking.
}

default void setBlockPlaceTarget(BlockPos pos, Direction side) {
// Optional hook for handlers that support targeted block placing.
}
}
16 changes: 14 additions & 2 deletions src/api/java/baritone/api/utils/IPlayerContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SlabBlock;
Expand Down Expand Up @@ -116,15 +117,26 @@ static double eyeHeight(boolean ifSneaking) {
*
* @return The position of the highlighted block
*/
default Optional<BlockPos> getSelectedBlock() {
default Optional<BlockHitResult> getSelectedBlockHitResult() {
HitResult result = objectMouseOver();
if (result != null && result.getType() == HitResult.Type.BLOCK) {
return Optional.of(((BlockHitResult) result).getBlockPos());
return Optional.of((BlockHitResult) result);
}
return Optional.empty();
}

default Optional<BlockPos> getSelectedBlock() {
return getSelectedBlockHitResult().map(BlockHitResult::getBlockPos);
}

default boolean isLookingAt(BlockPos pos) {
return getSelectedBlock().equals(Optional.of(pos));
}

default boolean isLookingAt(BlockPos pos, Direction side) {
return getSelectedBlockHitResult()
.filter(hit -> hit.getBlockPos().equals(pos))
.filter(hit -> hit.getDirection() == side)
.isPresent();
}
}
Loading