Начинающий
- Статус
- Оффлайн
- Регистрация
- 18 Авг 2025
- Сообщения
- 10
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
Ротация с рич клиента на экспенсив 3.1
SS -

SS -
Java:
case "SlothAI" -> {
if (target == null) break;
Vector3d eyes = player.getEyePosition(1.0f);
Vector3d targetPos = target.getBoundingBox().getCenter();
Vector3d diff = targetPos.subtract(eyes);
double distXZ = Math.sqrt(diff.x * diff.x + diff.z * diff.z);
float targetYaw = (float) wrapDegrees(Math.toDegrees(Math.atan2(diff.z, diff.x)) - 90.0f);
float targetPitch = (float) -Math.toDegrees(Math.atan2(diff.y, distXZ));
yawDelta = (float) wrapDegrees(targetYaw - rotateVector.x);
pitchDelta = (float) wrapDegrees(targetPitch - rotateVector.y);
float rotationDifference = (float) Math.hypot(Math.abs(yawDelta), Math.abs(pitchDelta));
float distanceToTarget = (float) player.getDistance(target);
boolean canAttack = target != null && player.getDistance(target) <= attackDistance();
float baseSpeed = canAttack ? 0.93f : 0.56f;
if (distanceToTarget > 0 && distanceToTarget < 0.66f) {
float closeRangeSpeed = MathHelper.clamp(distanceToTarget / 1.5f * 0.35f, 0.1f, 0.6f);
baseSpeed = canAttack ? 0.85f : Math.min(baseSpeed, closeRangeSpeed);
}
float jitterYaw = (float) (randomLerp(20, 26) * Math.sin(System.currentTimeMillis() / 25.0));
float jitterPitch = (float) (randomLerp(8, 23) * Math.sin(System.currentTimeMillis() / 27.0));
boolean shouldIdle = (!isState() || this.target == null) && stopWatch.hasTimeElapsed(1000, false);
if (shouldIdle) {
baseSpeed = 0.35f;
jitterYaw = 0;
jitterPitch = 0;
}
float moveYaw = MathHelper.clamp(yawDelta, -Math.abs(yawDelta / rotationDifference * 180), Math.abs(yawDelta / rotationDifference * 180));
float movePitch = MathHelper.clamp(pitchDelta, -Math.abs(pitchDelta / rotationDifference * 180), Math.abs(pitchDelta / rotationDifference * 180));
float finalYaw = MathHelper.lerp(baseSpeed, rotateVector.x, rotateVector.x + moveYaw) + jitterYaw;
float finalPitch = MathHelper.lerp(baseSpeed, rotateVector.y, rotateVector.y + movePitch) + jitterPitch;
finalPitch = clamp(finalPitch, -90.0f, 90.0f);
finalYaw = sanitizeYaw(finalYaw);
float gcd = SensUtils.getGCDValue();
if (gcd > 0.0f && gcd < 10.0f && !Float.isInfinite(gcd) && !Float.isNaN(gcd)) {
finalYaw = (float) (finalYaw - (finalYaw - rotateVector.x) % gcd);
finalPitch = (float) (finalPitch - (finalPitch - rotateVector.y) % gcd);
}
rotateVector = new Vector2f(finalYaw, finalPitch);
isRotated = true;
if (options.getValueByName("Коррекция движения").get()) {
player.rotationYawOffset = finalYaw;
}
}
Java:
private float randomLerp(float min, float max) {
return min + random.nextFloat() * (max - min);
}
Java:
private float sanitizeYaw(float yaw) {
while (yaw > 180.0F) {
yaw -= 360.0F;
}
while (yaw < -180.0F) {
yaw += 360.0F;
}
return yaw;
}

Последнее редактирование:


