private Vector3d getLegitTargetVector(LivingEntity target) {
if (target == null) return null;
AxisAlignedBB hitbox = target.getBoundingBox();
Random random = new Random();
double randomX = hitbox.minX + (hitbox.maxX - hitbox.minX) * random.nextDouble();
double randomY = hitbox.minY + (hitbox.maxY - hitbox.minY) * random.nextDouble();
double randomZ = hitbox.minZ + (hitbox.maxZ - hitbox.minZ) * random.nextDouble();
Vector3d newAimPoint = new Vector3d(randomX, randomY, randomZ);
if (previousAimPoint != null) {
double dist = newAimPoint.distanceTo(previousAimPoint);
if (dist < 0.4) {
newAimPoint = new Vector3d(
hitbox.minX + (hitbox.maxX - hitbox.minX) * random.nextDouble(),
hitbox.minY + (hitbox.maxY - hitbox.minY) * random.nextDouble(),
hitbox.minZ + (hitbox.maxZ - hitbox.minZ) * random.nextDouble()
);
}
}
if (previousAimPoint != null) {
newAimPoint = previousAimPoint.add(
newAimPoint.subtract(previousAimPoint).scale(0.3)
);
}
previousAimPoint = newAimPoint;
Vector3d playerEyes = mc.player.getEyePosition(1.0F);
return newAimPoint.subtract(playerEyes);
}
public void handleSpookyTime() {
if (!LookTarget(target)) return;
Vector3d rotationVector = getLegitTargetVector(target);
if (rotationVector == null) return;
float rawYaw = (float) Math.toDegrees(Math.atan2(-rotationVector.x, rotationVector.z));
float rawPitch = (float) -Math.toDegrees(Math.atan2(rotationVector.y,
Math.hypot(rotationVector.x, rotationVector.z)));
float yawDelta = MathHelper.wrapDegrees(rawYaw - rotateVector.x);
float pitchDelta = rawPitch - rotateVector.y;
SecureRandom random = new SecureRandom();
yawDelta = MathHelper.clamp(yawDelta, -60.0f, 60.0f);
pitchDelta = MathHelper.clamp(pitchDelta, -25.0f, 25.0f);
if (Math.abs(yawDelta) < 3.0f && Math.abs(pitchDelta) > 0)
yawDelta += (random.nextFloat() - 0.5f) * 6.0f;
if (Math.abs(pitchDelta) < 3.0f && Math.abs(yawDelta) > 0)
pitchDelta += (random.nextFloat() - 0.5f) * 4.0f;
float speed = 0.6f + random.nextFloat() * 0.1f;
float appliedYaw = rotateVector.x + yawDelta * speed;
float appliedPitch = rotateVector.y + pitchDelta * speed;
appliedYaw += (random.nextFloat() - 0.5f) * 0.8f;
appliedPitch += (random.nextFloat() - 0.5f) * 0.4f;
appliedPitch = MathHelper.clamp(appliedPitch, -80.0f, 80.0f);
rotateVector = new Vector2f(appliedYaw, appliedPitch);
if (correctionType.is("Сфокусированный")) {
mc.player.rotationYawOffset = rotateVector.x;
}
mc.player.rotationYawHead = rotateVector.x;
}