private void handleSpookyTime() {
Vector3d targetVec = target.getPositionVec()
.add(0, target.getEyeHeight() - 0.15f, 0)
.subtract(mc.player.getEyePosition(mc.getRenderPartialTicks()));
float rawYaw = (float) Math.toDegrees(Math.atan2(-targetVec.x, targetVec.z));
float rawPitch = (float) MathHelper.clamp(-Math.toDegrees(Math.atan2(targetVec.y, Math.hypot(targetVec.x, targetVec.z))), -90, 90);
float microYaw = AdvancedRandomUtil.LegitFloat(-0.4f, 0.4f, AdvancedRandomUtil.PatternMode.HUMAN_TREMOR);
float microPitch = AdvancedRandomUtil.LegitFloat(-0.4f, 0.4f, AdvancedRandomUtil.PatternMode.HUMAN_TREMOR);
float predictionOffset = (float) (Math.sin(System.currentTimeMillis() / 200.0) * 2.0);
smoothFactor = MathHelper.lerp(0.15f, smoothFactor, 1.0f);
float distanceFactor = Math.min(1.0f, (float) (mc.player.getDistance(target) / range.get()));
Vector3d targetMotion = new Vector3d(
target.getPosX() - target.lastTickPosX,
target.getPosY() - target.lastTickPosY,
target.getPosZ() - target.lastTickPosZ
);
float adaptiveYawOffset = (float) (Math.atan2(targetMotion.x, targetMotion.z) * 2.0);
float adaptivePitchOffset = (float) (Math.atan2(targetMotion.y, Math.hypot(targetMotion.x, targetMotion.z)) * 2.0);
lastYawOffset = MathHelper.lerp(0.2f, lastYawOffset, adaptiveYawOffset + microYaw);
lastPitchOffset = MathHelper.lerp(0.2f, lastPitchOffset, adaptivePitchOffset + microPitch);
float finalYaw = rawYaw + lastYawOffset * smoothFactor + predictionOffset * distanceFactor;
float finalPitch = rawPitch + lastPitchOffset * smoothFactor;
float gcd = SensUtils.getGCDValue();
finalYaw -= (finalYaw - rotateVector.x) % gcd;
finalPitch -= (finalPitch - rotateVector.y) % gcd;
float maxRotationSpeed = 20.0f + AdvancedRandomUtil.LegitFloat(-5.0f, 5.0f, AdvancedRandomUtil.PatternMode.CHAOTIC_SMOOTH);
float yawDelta = MathHelper.wrapDegrees(finalYaw - rotateVector.x);
float pitchDelta = finalPitch - rotateVector.y;
yawDelta = MathHelper.clamp(yawDelta, -maxRotationSpeed, maxRotationSpeed);
pitchDelta = MathHelper.clamp(pitchDelta, -maxRotationSpeed, maxRotationSpeed);
rotateVector = new Vector2f(
rotateVector.x + yawDelta,
MathHelper.clamp(rotateVector.y + pitchDelta, -90.0f, 90.0f)
);
if (correctionType.is("Сфокусированный")) {
mc.player.rotationYawOffset = rotateVector.x;
}
}
Vector3d targetVec = target.getPositionVec()
.add(0, target.getEyeHeight() - 0.15f, 0)
.subtract(mc.player.getEyePosition(mc.getRenderPartialTicks()));
float rawYaw = (float) Math.toDegrees(Math.atan2(-targetVec.x, targetVec.z));
float rawPitch = (float) MathHelper.clamp(-Math.toDegrees(Math.atan2(targetVec.y, Math.hypot(targetVec.x, targetVec.z))), -90, 90);
float microYaw = AdvancedRandomUtil.LegitFloat(-0.4f, 0.4f, AdvancedRandomUtil.PatternMode.HUMAN_TREMOR);
float microPitch = AdvancedRandomUtil.LegitFloat(-0.4f, 0.4f, AdvancedRandomUtil.PatternMode.HUMAN_TREMOR);
float predictionOffset = (float) (Math.sin(System.currentTimeMillis() / 200.0) * 2.0);
smoothFactor = MathHelper.lerp(0.15f, smoothFactor, 1.0f);
float distanceFactor = Math.min(1.0f, (float) (mc.player.getDistance(target) / range.get()));
Vector3d targetMotion = new Vector3d(
target.getPosX() - target.lastTickPosX,
target.getPosY() - target.lastTickPosY,
target.getPosZ() - target.lastTickPosZ
);
float adaptiveYawOffset = (float) (Math.atan2(targetMotion.x, targetMotion.z) * 2.0);
float adaptivePitchOffset = (float) (Math.atan2(targetMotion.y, Math.hypot(targetMotion.x, targetMotion.z)) * 2.0);
lastYawOffset = MathHelper.lerp(0.2f, lastYawOffset, adaptiveYawOffset + microYaw);
lastPitchOffset = MathHelper.lerp(0.2f, lastPitchOffset, adaptivePitchOffset + microPitch);
float finalYaw = rawYaw + lastYawOffset * smoothFactor + predictionOffset * distanceFactor;
float finalPitch = rawPitch + lastPitchOffset * smoothFactor;
float gcd = SensUtils.getGCDValue();
finalYaw -= (finalYaw - rotateVector.x) % gcd;
finalPitch -= (finalPitch - rotateVector.y) % gcd;
float maxRotationSpeed = 20.0f + AdvancedRandomUtil.LegitFloat(-5.0f, 5.0f, AdvancedRandomUtil.PatternMode.CHAOTIC_SMOOTH);
float yawDelta = MathHelper.wrapDegrees(finalYaw - rotateVector.x);
float pitchDelta = finalPitch - rotateVector.y;
yawDelta = MathHelper.clamp(yawDelta, -maxRotationSpeed, maxRotationSpeed);
pitchDelta = MathHelper.clamp(pitchDelta, -maxRotationSpeed, maxRotationSpeed);
rotateVector = new Vector2f(
rotateVector.x + yawDelta,
MathHelper.clamp(rotateVector.y + pitchDelta, -90.0f, 90.0f)
);
if (correctionType.is("Сфокусированный")) {
mc.player.rotationYawOffset = rotateVector.x;
}
}