From 0373f1875f9d30d5afe7ecf3974bcbf724a35d99 Mon Sep 17 00:00:00 2001 From: Brady Date: Mon, 5 Nov 2018 16:05:25 -0600 Subject: [PATCH] Meme --- .../baritone/api/event/events/type/EventState.java | 6 ++---- .../java/baritone/launch/mixins/MixinEntity.java | 6 +++--- .../baritone/launch/mixins/MixinEntityLivingBase.java | 6 +++--- src/main/java/baritone/behavior/LookBehavior.java | 11 ++++++++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/api/java/baritone/api/event/events/type/EventState.java b/src/api/java/baritone/api/event/events/type/EventState.java index 10b633bd..072e12c1 100644 --- a/src/api/java/baritone/api/event/events/type/EventState.java +++ b/src/api/java/baritone/api/event/events/type/EventState.java @@ -24,14 +24,12 @@ package baritone.api.event.events.type; public enum EventState { /** - * Indicates that whatever movement the event is being - * dispatched as a result of is about to occur. + * Before the dispatching of what the event is targetting */ PRE, /** - * Indicates that whatever movement the event is being - * dispatched as a result of has already occurred. + * After the dispatching of what the event is targetting */ POST } diff --git a/src/launch/java/baritone/launch/mixins/MixinEntity.java b/src/launch/java/baritone/launch/mixins/MixinEntity.java index db8b513f..6623e1c2 100644 --- a/src/launch/java/baritone/launch/mixins/MixinEntity.java +++ b/src/launch/java/baritone/launch/mixins/MixinEntity.java @@ -64,10 +64,10 @@ public class MixinEntity { target = "net/minecraft/entity/Entity.rotationYaw:F" ) ) - private float overrideYaw(Entity entity) { - if (entity instanceof EntityPlayerSP) { + private float overrideYaw(Entity self) { + if (self instanceof EntityPlayerSP) { return this.motionUpdateRotationEvent.getYaw(); } - return entity.rotationYaw; + return self.rotationYaw; } } diff --git a/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java b/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java index 42aa9bf0..8e2eb515 100644 --- a/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java +++ b/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java @@ -68,10 +68,10 @@ public abstract class MixinEntityLivingBase extends Entity { target = "net/minecraft/entity/EntityLivingBase.rotationYaw:F" ) ) - private float overrideYaw(EntityLivingBase entity) { - if (entity instanceof EntityPlayerSP) { + private float overrideYaw(EntityLivingBase self) { + if (self instanceof EntityPlayerSP) { return this.jumpRotationEvent.getYaw(); } - return entity.rotationYaw; + return self.rotationYaw; } } diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index bcaf487e..ee8548a2 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -26,6 +26,7 @@ import baritone.api.utils.Rotation; import baritone.utils.Helper; public final class LookBehavior extends Behavior implements ILookBehavior, Helper { + /** * Target's values are as follows: *

@@ -63,7 +64,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior, Helpe } // Whether or not we're going to silently set our angles - boolean silent = Baritone.settings().antiCheatCompatibility.get(); + boolean silent = Baritone.settings().antiCheatCompatibility.get() && !this.force; switch (event.getState()) { case PRE: { @@ -76,14 +77,15 @@ public final class LookBehavior extends Behavior implements ILookBehavior, Helpe nudgeToLevel(); } this.target = null; - } else if (silent) { + } + if (silent) { this.lastYaw = player().rotationYaw; player().rotationYaw = this.target.getYaw(); } break; } case POST: { - if (!this.force && silent) { + if (silent) { player().rotationYaw = this.lastYaw; this.target = null; } @@ -108,6 +110,9 @@ public final class LookBehavior extends Behavior implements ILookBehavior, Helpe } } + /** + * Nudges the player's pitch to a regular level. (Between {@code -20} and {@code 10}, increments are by {@code 1}) + */ private void nudgeToLevel() { if (player().rotationPitch < -20) { player().rotationPitch++;