From 314f2804005785eab4d4685966cc8e4efe11c53c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 22 Jan 2019 17:25:53 -0800 Subject: [PATCH] pigs --- .../baritone/launch/mixins/MixinEntityPlayerSP.java | 11 +++++++++++ src/main/java/baritone/behavior/LookBehavior.java | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java b/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java index 48ac8c94..bbf92011 100644 --- a/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java +++ b/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java @@ -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(); + } } diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index 31e76913..c2d0326c 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -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) {