diff --git a/src/main/java/io/github/fabriccommunity/events/impl/ChickenTurnLeftImpl.java b/src/main/java/io/github/fabriccommunity/events/impl/ChickenTurnLeftImpl.java index 13c66b0..6aaa1df 100644 --- a/src/main/java/io/github/fabriccommunity/events/impl/ChickenTurnLeftImpl.java +++ b/src/main/java/io/github/fabriccommunity/events/impl/ChickenTurnLeftImpl.java @@ -27,10 +27,4 @@ public static float hackChangeAngle(ChickenEntity entity, float headYaw, float t } return MathHelper.wrapDegrees(h); } - - public static float noHackChangeAngle(float headYaw, float targetYaw, float yawSpeed) { - float f = MathHelper.subtractAngles(headYaw, targetYaw); - float g = MathHelper.clamp(f, -yawSpeed, yawSpeed); - return MathHelper.wrapDegrees(headYaw + g); - } } diff --git a/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinLookControl.java b/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinLookControl.java index 57b7a93..7018479 100644 --- a/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinLookControl.java +++ b/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinLookControl.java @@ -17,6 +17,8 @@ @Mixin(LookControl.class) public abstract class MixinLookControl { + @Shadow abstract float changeAngle(float from, float to, float max); + @Redirect( at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/control/LookControl;changeAngle(FFF)F", ordinal = 0), method = "tick" @@ -24,7 +26,7 @@ public abstract class MixinLookControl { private float redirectHeadChangeAngle(LookControl self, float headYaw, float targetYaw, float yawSpeed) { return (entity instanceof ChickenEntity) ? ChickenTurnLeftImpl.hackChangeAngle((ChickenEntity) entity, headYaw, targetYaw, yawSpeed, ChickenTurnLeftCallback.TurnLeftType.HEAD) - : ChickenTurnLeftImpl.noHackChangeAngle(headYaw, targetYaw, yawSpeed); + : this.changeAngle(headYaw, targetYaw, yawSpeed); } @Redirect( @@ -34,7 +36,7 @@ private float redirectHeadChangeAngle(LookControl self, float headYaw, float tar private float redirectBodyChangeAngle(LookControl self, float headYaw, float targetYaw, float yawSpeed) { return (entity instanceof ChickenEntity) ? ChickenTurnLeftImpl.hackChangeAngle((ChickenEntity) entity, headYaw, targetYaw, yawSpeed, ChickenTurnLeftCallback.TurnLeftType.BODY) - : ChickenTurnLeftImpl.noHackChangeAngle(headYaw, targetYaw, yawSpeed); + : this.changeAngle(headYaw, targetYaw, yawSpeed); } @Shadow @Final private MobEntity entity; diff --git a/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinMoveControl.java b/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinMoveControl.java index 9dad9d3..bc6586d 100644 --- a/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinMoveControl.java +++ b/src/main/java/io/github/fabriccommunity/events/mixin/world/MixinMoveControl.java @@ -17,6 +17,8 @@ @Mixin(MoveControl.class) public abstract class MixinMoveControl { + @Shadow abstract float changeAngle(float from, float to, float max); + @Redirect( at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/control/MoveControl;changeAngle(FFF)F", ordinal = 0), method = "tick" @@ -24,7 +26,7 @@ public abstract class MixinMoveControl { private float redirectBodyChangeAngle(MoveControl self, float headYaw, float targetYaw, float yawSpeed) { return (entity instanceof ChickenEntity) ? ChickenTurnLeftImpl.hackChangeAngle((ChickenEntity) entity, headYaw, targetYaw, yawSpeed, ChickenTurnLeftCallback.TurnLeftType.BODY) - : ChickenTurnLeftImpl.noHackChangeAngle(headYaw, targetYaw, yawSpeed); + : this.changeAngle(headYaw, targetYaw, yawSpeed); } @Shadow @Final private MobEntity entity;