Начинающий
- Статус
- Оффлайн
- Регистрация
- 30 Июн 2023
- Сообщения
- 85
- Реакции
- 1
- Выберите загрузчик игры
- ForgeOptiFine
- Прочие моды
rotka:
private void updateMineBlazeRotation() {
if (target == null) return;
Vector3d vec = target.getPositionVec().add(0, target.getEyeHeight() * 0.9, 0)
.subtract(mc.player.getEyePosition(1.0F));
float yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
float pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.sqrt(vec.x * vec.x + vec.z * vec.z))));
boolean wasInHitbox = isInHitbox;
isInHitbox = isCursorOnHitbox(yawToTarget, pitchToTarget);
if (isInHitbox != wasInHitbox) {
if (isInHitbox) {
currentSpeedMultiplier = 0.2f;
isAccelerating = false;
} else {
isAccelerating = true;
accelerationStartTime = System.currentTimeMillis();
accelerationDelay = 100 + random.nextInt(21);
}
}
if (isAccelerating && System.currentTimeMillis() - accelerationStartTime >= accelerationDelay) {
float accelerationProgress = Math.min((System.currentTimeMillis() - accelerationStartTime - accelerationDelay) / 200f, 1f);
currentSpeedMultiplier = 0.2f + accelerationProgress * 1.0f;
if (accelerationProgress >= 1f) {
isAccelerating = false;
currentSpeedMultiplier = 1.0f;
}
}
float yaw;
float pitch;
float baseYawSpeed = 80.0f * 1.5f * currentSpeedMultiplier;
float basePitchSpeed = 35.0f * 1.5f * currentSpeedMultiplier;
float yawDelta = wrapDegrees(yawToTarget - rotateVector.x);
float pitchDelta = wrapDegrees(pitchToTarget - rotateVector.y);
if (this.selected != this.target && this.options.get(6).get()) {
float attackSpeedMultiplier = 1.0f * currentSpeedMultiplier;
yaw = rotateVector.x + yawDelta * attackSpeedMultiplier;
pitch = clamp(rotateVector.y + pitchDelta * attackSpeedMultiplier, -89.0F, 89.0F);
} else {
float dynamicYawSpeed = calculateDynamicSpeed(Math.abs(yawDelta), baseYawSpeed);
float dynamicPitchSpeed = calculateDynamicSpeed(Math.abs(pitchDelta), basePitchSpeed);
float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), dynamicYawSpeed);
float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), dynamicPitchSpeed);
float accelerationFactor = calculateAccelerationFactor(Math.abs(yawDelta));
yawSpeed *= accelerationFactor;
pitchSpeed *= accelerationFactor;
yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
}
float time = mc.player.ticksExisted * 0.8f;
float circleAmplitude = 1.8f + (float) Math.sin(time * 0.4f) * 2.2f;
yaw += (float) Math.sin(time * 1.3f) * circleAmplitude * 0.9f;
pitch += (float) Math.cos(time * 1.1f) * circleAmplitude * 0.7f;
float chaosFactor = isInHitbox ? 0.1f : 0.3f;
if (mc.player.ticksExisted % 2 == 0) {
yaw += (random.nextFloat() - 0.5f) * chaosFactor;
pitch += (random.nextFloat() - 0.5f) * chaosFactor * 0.6f;
}
float smoothSway = (float) Math.sin(time * 2.1f) * 0.008f;
float smoothBob = (float) Math.cos(time * 1.8f) * 0.015f;
yaw += smoothSway;
pitch += smoothBob;
float gcd = (float) SensUtils.getGCDValue();
float gcdRandomizer = 1.85f + random.nextFloat() * 0.45f;
yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
float maxYawChange = 32.0f + (float) Math.sin(time * 0.7f) * 6.0f;
float maxPitchChange = 25.0f + (float) Math.cos(time * 0.8f) * 5.0f;
yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
rotateVector = new Vector2f(yaw, pitch);
lastYaw = yaw;
lastPitch = pitch;
if (this.options.get(4).get()) {
mc.player.rotationYawOffset = yaw;
mc.player.rotationPitchOffset = pitch;
}
}
доп методы:
private float calculateDynamicSpeed(float angleDelta, float maxSpeed) {
if (angleDelta > 45f) {
return maxSpeed * 0.6f;
} else if (angleDelta > 20f) {
return maxSpeed * 0.8f;
} else if (angleDelta > 5f) {
return maxSpeed * 1.2f;
} else {
return maxSpeed * 0.9f;
}
}
private float calculateAccelerationFactor(float angleDelta) {
float progress = Math.min(angleDelta / 90f, 1.0f);
if (progress > 0.7f) {
return 0.3f + (progress - 0.7f) / 0.3f * 0.7f;
} else if (progress > 0.3f) {
return 1.0f;
} else {
return 0.3f + progress / 0.3f * 0.7f;
}
}
ss -
Пожалуйста, авторизуйтесь для просмотра ссылки.
(модеры, не удаляйте тему пж, видео грузиться)