From c0e0f8dc2a3537f2cd463ba03cfe9c1d3cfdd5ff Mon Sep 17 00:00:00 2001 From: Brady Date: Mon, 5 Nov 2018 13:53:26 -0600 Subject: [PATCH] Fix last commit lol --- .../api/event/events/RotationMoveEvent.java | 9 ++++++++ .../java/baritone/behavior/LookBehavior.java | 21 ++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/api/java/baritone/api/event/events/RotationMoveEvent.java b/src/api/java/baritone/api/event/events/RotationMoveEvent.java index 7f98947d..790318e0 100644 --- a/src/api/java/baritone/api/event/events/RotationMoveEvent.java +++ b/src/api/java/baritone/api/event/events/RotationMoveEvent.java @@ -44,6 +44,15 @@ public final class RotationMoveEvent extends ManagedPlayerEvent { this.yaw = yaw; } + /** + * Set the yaw movement rotation + * + * @param yaw Yaw rotation + */ + public final void setYaw(float yaw) { + this.yaw = yaw; + } + /** * @return The yaw rotation */ diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index ac3a4698..bcaf487e 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -97,22 +97,13 @@ public final class LookBehavior extends Behavior implements ILookBehavior, Helpe @Override public void onPlayerRotationMove(RotationMoveEvent event) { if (this.target != null && !this.force) { - switch (event.getState()) { - case PRE: - this.lastYaw = player().rotationYaw; - player().rotationYaw = this.target.getYaw(); - break; - case POST: - player().rotationYaw = this.lastYaw; - // If we have antiCheatCompatibility on, we're going to use the target value later in onPlayerUpdate() - // Also the type has to be MOTION_UPDATE because that is called after JUMP - if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE) { - this.target = null; - } - break; - default: - break; + event.setYaw(this.target.getYaw()); + + // If we have antiCheatCompatibility on, we're going to use the target value later in onPlayerUpdate() + // Also the type has to be MOTION_UPDATE because that is called after JUMP + if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE) { + this.target = null; } } }