private Rotation testFullStep(Rotation current, Rotation target, boolean canAttack) {
RotationDelta d = current.rotationDeltaTo(target);
float yawDelta = d.getDeltaYaw();
float pitchDelta = d.getDeltaPitch();
float rotationDifference = (float) Math.hypot(Math.abs(yawDelta), Math.abs(pitchDelta));
if (rotationDifference < 1.0e-3f) return target;
float lineYaw = Math.abs(yawDelta / rotationDifference) * 180f;
float linePitch = Math.abs(pitchDelta / rotationDifference) * 180f;
float moveYaw = MathHelper.clamp(yawDelta, -lineYaw, lineYaw);
float movePitch = MathHelper.clamp(pitchDelta, -linePitch, linePitch);
if (canAttack) {
float speed = 1.0f;
float t = MathHelper.clamp(randomLerp(speed, speed + 0.2f), 0f, 1f);
float newYaw = MathHelper.lerp(t, current.getYaw(), current.getYaw() + moveYaw);
float newPitch = MathHelper.lerp(t, current.getPitch(), current.getPitch() + movePitch);
Rotation out = new Rotation(newYaw, newPitch);
return out.normalize(rotationManager.getCurrentRotation());
} else {
float yawDiffToTarget = Math.abs(MathHelper.wrapDegrees(mc.player.getYaw() - target.getYaw()));
float pitchDiffToTarget = Math.abs(mc.player.getPitch() - target.getPitch());
boolean lookedAway = yawDiffToTarget > 25f || pitchDiffToTarget > 15f;
boolean finished2000 = AttackUtil.getAttackTimer().finished(450L) || lookedAway;
float time = (System.currentTimeMillis() % 100000L) / 1000f;
float yawOsc = (float) (Math.sin(time * 20.0f) * 65f);
float pitchOsc = (float) (Math.cos(time * 8.0f) * 8f);
float centerYaw = finished2000 ? mc.player.getYaw() : target.getYaw();
float centerPitch = finished2000 ? mc.player.getPitch() : target.getPitch();
float t2 = finished2000 ? 0.15f : 1.0f;
float desiredYaw = centerYaw + yawOsc;
float desiredPitch = centerPitch + pitchOsc;
boolean upWindow = AttackUtil.getAttackTimer().finished(5000L) && !AttackUtil.getAttackTimer().finished(5200L);
boolean backWindow = AttackUtil.getAttackTimer().finished(5200L) && !AttackUtil.getAttackTimer().finished(5400L);
if (upWindow) {
float upPitch = -60f;
desiredPitch = MathHelper.lerp(0.85f, current.getPitch(), upPitch);
desiredYaw = MathHelper.lerp(0.6f, current.getYaw(), centerYaw);
t2 = 1.0f;
} else if (backWindow) {
desiredPitch = MathHelper.lerp(0.35f, current.getPitch(), centerPitch);
desiredYaw = MathHelper.lerp(0.30f, current.getYaw(), centerYaw);
t2 = 0.30f;
}
float newYaw2 = MathHelper.lerp(t2, current.getYaw(), desiredYaw);
float newPitch2 = MathHelper.lerp(t2, current.getPitch(), desiredPitch);
Rotation out2 = new Rotation(newYaw2, newPitch2);
return out2.normalize(rotationManager.getCurrentRotation());
}
}