Skip to content

Commit

Permalink
Added smoothAim setting
Browse files Browse the repository at this point in the history
  • Loading branch information
SM1LLER committed Jan 14, 2022
1 parent c4da682 commit 7e7d7d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ archives_base_name=baritone
minecraft_version=1.18
forge_version=1.18-38.0.10
fabric_version=0.12.5
baritone.fabric_build=true

# # un comment for forge debugging default (as opposed to fabric)
# baritone.forge_build=true
Expand Down
6 changes: 6 additions & 0 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ public final class Settings {
*/
public final Setting<Double> randomLooking113 = new Setting<>(2d);

/**
* Enable smooth aim while mining/building. Aim is updated per tick (20 = 1 second)
* set to 1 to disable.
*/
public final Setting<Integer> smoothAim = new Setting<>(1);

/**
* Block reach distance
*/
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/baritone/behavior/LookBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,13 @@ public void onPlayerUpdate(PlayerUpdateEvent event) {
switch (event.getState()) {
case PRE: {
if (this.force) {
ctx.player().setYRot(this.target.getYaw());
float oldPitch = ctx.player().getXRot();
float desiredPitch = this.target.getPitch();
ctx.player().setXRot(desiredPitch);
float desiredYaw = Math.round(this.target.getYaw());
float oldPitch = Math.round(ctx.player().getXRot());
float desiredPitch = Math.round(this.target.getPitch());
double xPos = ctx.player().getX();
double yPos = ctx.player().getY();
double zPos = ctx.player().getZ();
ctx.player().lerpTo(xPos,yPos,zPos, desiredYaw, desiredPitch, Baritone.settings().smoothAim.value, true);
ctx.player().setYRot((float) (ctx.player().getYRot() + (Math.random() - 0.5) * Baritone.settings().randomLooking.value));
ctx.player().setXRot((float) (ctx.player().getXRot() + (Math.random() - 0.5) * Baritone.settings().randomLooking.value));
if (desiredPitch == oldPitch && !Baritone.settings().freeLook.value) {
Expand Down

0 comments on commit 7e7d7d9

Please sign in to comment.