Рандом точку, джитер, и джитер после удара, и плавную ротку и всё
Нет, откинет за 5-10 минут
private void updateSpookyRotation(LivingEntity target, RotationHandler handler, MoveCorrection moveCorrection) {
double timer = System.currentTimeMillis() / 500.0;
if (killauraEnabled && !wasKillauraEnabled) {
lastKillauraYaw = this.rotateVector.y;
lastKillauraPitch = this.rotateVector.x;
} else if (!killauraEnabled && wasKillauraEnabled) {
driftStartYaw = this.rotateVector.y;
driftStartPitch = this.rotateVector.x;
driftTargetYaw = lastKillauraYaw;
driftTargetPitch = lastKillauraPitch;
driftProgress = 0.0f;
driftDuration = 20 + random.nextInt(15);
}
wasKillauraEnabled = killauraEnabled;
if (!killauraEnabled && driftProgress < 1.0f) {
driftProgress += 1.0f / driftDuration;
float easedProgress = easeOutCubic(Math.min(driftProgress, 1.0f));
float currentYaw = driftStartYaw + (driftTargetYaw - driftStartYaw) * easedProgress;
float currentPitch = driftStartPitch + (driftTargetPitch - driftStartPitch) * easedProgress;
handler.rotate(new Rotation(currentPitch, currentYaw), moveCorrection,
180.0f, 180.0f, 180.0f, RotationPriority.TO_TARGET);
return;
}
if (!killauraEnabled) return;
float baseSnapSpeed = 60.0f;
float snapSpeedYaw = baseSnapSpeed;
float snapSpeedPitch = baseSnapSpeed * 0.6f;
float maxYawChange = 90.0f;
float maxPitchChange = maxYawChange * 0.7f;
float yawChange = MathHelper.clamp(yawDelta, -snapSpeedYaw, snapSpeedYaw);
float pitchChange = MathHelper.clamp(pitchDelta, -snapSpeedPitch, snapSpeedPitch);
yawChange = MathHelper.clamp(yawChange, -maxYawChange, maxYawChange);
pitchChange = MathHelper.clamp(pitchChange, -maxPitchChange, maxPitchChange);
float distanceToTarget = target.getDistanceToEntity(mc.player);
float distanceFactor = MathHelper.clamp(1.0f - (distanceToTarget - 2.0f) / 10.0f, 0.3f, 1.0f);
float jitterAmplitudeYaw = (2.5f + random.nextFloat() * 3.5f) * distanceFactor;
float jitterAmplitudePitch = (1.0f + random.nextFloat() * 2.0f) * distanceFactor;
float jitterSpeedYaw = 0.08f + random.nextFloat() * 0.25f;
float jitterSpeedPitch = 0.06f + random.nextFloat() * 0.2f;
float jitterYaw = (float)(Math.sin(timer * jitterSpeedYaw) * jitterAmplitudeYaw +
Math.cos(timer * jitterSpeedYaw * 1.7f) * (jitterAmplitudeYaw * 0.6f));
float jitterPitch = (float)(Math.sin(timer * jitterSpeedPitch * 1.3f) * jitterAmplitudePitch +
Math.cos(timer * jitterSpeedPitch * 2.1f) * (jitterAmplitudePitch * 0.5f));
Vec3 targetPos = getRandomHitboxPoint(target);
Rotation targetRotation = MathHelper.calculateRotationFromVec3(targetPos);
float targetYaw = targetRotation.getYaw();
float targetPitch = targetRotation.getPitch();
float headMultiplier = 0.85f + random.nextFloat() * 0.3f;
float chestMultiplier = 0.7f + random.nextFloat() * 0.4f;
if (random.nextFloat() < 0.15f) {
currentTargetZone = random.nextBoolean() ? "head" : "chest";
}
float zoneMultiplier = currentTargetZone.equals("head") ? headMultiplier : chestMultiplier;
float finalYaw = targetYaw + jitterYaw;
float finalPitch = targetPitch * zoneMultiplier + jitterPitch;
float smoothFactor = 0.65f + random.nextFloat() * 0.2f;
this.rotateVector = new Vec2(finalPitch, finalYaw);
lastKillauraYaw = finalYaw;
lastKillauraPitch = finalPitch;
handler.rotate(new Rotation(this.rotateVector.x, this.rotateVector.y),
moveCorrection, 180.0f, 180.0f, 180.0f, RotationPriority.TO_TARGET);
}
private Vec3 getRandomHitboxPoint(LivingEntity target) {
AxisAlignedBB boundingBox = target.getBoundingBox();
double minX = boundingBox.minX;
double maxX = boundingBox.maxX;
double minY = boundingBox.minY;
double maxY = boundingBox.maxY;
double minZ = boundingBox.minZ;
double maxZ = boundingBox.maxZ;
double yRange;
if (random.nextFloat() < 0.7f) {
yRange = minY + (maxY - minY) * (0.6f + random.nextFloat() * 0.4f);
} else {
yRange = minY + random.nextFloat() * (maxY - minY);
}
double xRange = minX + random.nextFloat() * (maxX - minX);
double zRange = minZ + random.nextFloat() * (maxZ - minZ);
return new Vec3(xRange, yRange, zRange);
}
private float easeOutCubic(float t) {
return 1.0f - (float)Math.pow(1.0f - t, 3);
} конечно же немного гпт, но должно обходить