This commit is contained in:
Leijurv 2019-01-22 17:25:53 -08:00
parent b75f4bf9a9
commit 314f280400
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import baritone.api.event.events.ChatEvent;
import baritone.api.event.events.PlayerUpdateEvent;
import baritone.api.event.events.SprintStateEvent;
import baritone.api.event.events.type.EventState;
import baritone.behavior.LookBehavior;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.PlayerCapabilities;
@ -102,4 +103,14 @@ public class MixinEntityPlayerSP {
BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this).getGameEventHandler().onPlayerSprintState(event);
return event.getState() == null ? keyBinding.isKeyDown() : event.getState();
}
@Inject(
method = "updateRidden",
at = @At(
value = "HEAD"
)
)
private void updateRidden(CallbackInfo cb) {
((LookBehavior) BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this).getLookBehavior()).pig();
}
}

View File

@ -95,6 +95,12 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
}
}
public void pig() {
if (this.target != null) {
ctx.player().rotationYaw = this.target.getYaw();
}
}
@Override
public void onPlayerRotationMove(RotationMoveEvent event) {
if (this.target != null && !this.force) {