This commit is contained in:
Brady 2018-11-05 16:05:25 -06:00
parent f286c400a3
commit 0373f1875f
No known key found for this signature in database
GPG Key ID: 73A788379A197567
4 changed files with 16 additions and 13 deletions

View File

@ -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
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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:
* <p>
@ -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++;