Начинающий
- Статус
- Оффлайн
- Регистрация
- 26 Авг 2025
- Сообщения
- 67
- Реакции
- 0
бля помогите пж с ротацией под Фантайм, я типо сделал(через ии, чуть подсмотрел с фришек, у которых обходит, баниться спустя 10 минут я хз как фикс, помогите пожалуйста, играть хочу пиздец)
ы:
package wtf.ray.systems.modules.modules.combat.AuraDev;
import wtf.ray.systems.modules.modules.combat.AttackAura;
import wtf.ray.utility.rotations.MoveCorrection;
import wtf.ray.utility.rotations.Rotation;
import wtf.ray.utility.rotations.RotationHandler;
import wtf.ray.utility.rotations.RotationPriority;
import wtf.ray.utility.rotations.RotationMath;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import static wtf.ray.utility.interfaces.IMinecraft.mc;
public class FuntimeSnapRotation {
private static final float MIN_ROTATION_DIFFERENCE = 1.0E-4f;
private final AttackAura aura;
private final FunTimePointFinder pointFinder = new FunTimePointFinder();
private long smoothbackShakeStartMs = -1L;
private int reducedHitboxAttackCounter = 0;
public FuntimeSnapRotation(AttackAura aura) {
this.aura = aura;
}
private float hypot(float yaw, float pitch) {
return Math.max((float)Math.hypot(Math.abs(yaw), Math.abs(pitch)), MIN_ROTATION_DIFFERENCE);
}
public void applyRotation(RotationHandler handler, MoveCorrection moveCorrection, LivingEntity entity) {
if (mc.player == null || entity == null) {
return;
}
Rotation currentRot = handler.getCurrentRotation();
Vec3d eyePos = mc.player.getEyePos();
Box box = entity.getBoundingBox();
Vec3d targetPoint = new Vec3d(
MathHelper.clamp(eyePos.x, box.minX, box.maxX),
MathHelper.clamp(eyePos.y, box.minY, box.maxY),
MathHelper.clamp(eyePos.z, box.minZ, box.maxZ)
);
Rotation targetRot = RotationMath.getRotationTo(targetPoint);
float attackDist = aura.getAttackDistance().getCurrentValue();
float distToTarget = (float) mc.player.squaredDistanceTo(entity);
boolean isInAttackRange = distToTarget <= attackDist * attackDist;
boolean isCooledDown = aura.isCooledDown();
if (isInAttackRange && isCooledDown) {
this.smoothbackShakeStartMs = -1L;
Rotation diffRot = RotationMath.subtract(targetRot, currentRot);
float f2 = diffRot.getYaw(); // yawDiff
float f3 = diffRot.getPitch(); // pitchDiff
float f4 = hypot(f2, f3);
float f5 = Math.abs(f2 / f4) * 130.0f;
float f6 = Math.abs(f3 / f4) * 130.0f;
// Сглаживание 0.85 с clamp - 1:1 порт строки 47
float newYaw = MathHelper.lerp(0.85f, currentRot.getYaw(),
currentRot.getYaw() + MathHelper.clamp(f2, -f5, f5));
float newPitch = MathHelper.lerp(0.85f, currentRot.getPitch(),
currentRot.getPitch() + MathHelper.clamp(f3, -f6, f6));
handler.rotate(new Rotation(newYaw, newPitch), moveCorrection,
180f, 180f, 180f, RotationPriority.TO_TARGET);
return;
}
// Режим ДРЕЙФА (когда нет цели или не в зоне атаки)
// 1:1 порт строки 49-68 из l.金金
// 金玉5 = new 金玉(mc.player.getYaw(), mc.player.getPitch()) - РЕАЛЬНАЯ ротация игрока!
Rotation playerRealRot = new Rotation(mc.player.getYaw(), mc.player.getPitch());
// 金玉6 = 金玉耳.火(金玉2, 金玉5) - разница между handler и реальной ротацией
Rotation diffToPlayer = RotationMath.subtract(currentRot, playerRealRot);
float f7 = diffToPlayer.getYaw();
float f8 = diffToPlayer.getPitch();
// f9 = this.目(f7, f8)
float f9 = hypot(f7, f8);
// Дрейф: f10 = random(6,8) * sin(time/60), f11 = random(3,8) * cos(time/60)
float f10 = (float)((double)randomBetween(6, 8) * Math.sin((double)System.currentTimeMillis() / 60.0));
float f11 = (float)((double)randomBetween(3, 8) * Math.cos((double)System.currentTimeMillis() / 60.0));
// Smoothback fade - когда нет цели или не в зоне
float f;
if (!isInAttackRange) {
if (this.smoothbackShakeStartMs < 0L) {
this.smoothbackShakeStartMs = System.currentTimeMillis();
}
f = 1.0f - MathHelper.clamp((float)(System.currentTimeMillis() - this.smoothbackShakeStartMs) / 500.0f, 0.0f, 1.0f);
f10 *= f;
f11 *= f;
} else {
this.smoothbackShakeStartMs = -1L;
f = 1.0f;
}
// Джиттер 45° только когда attackTimer >= 535ms (1:1 строка 66-67)
// !金舟2.竹().雨(535.0) - проверка что прошло 535ms с последней атаки
boolean attackTimerPassed = aura.getAttackTimer().finished(535L);
float jitterYaw = Math.abs(f7 / f9) * (attackTimerPassed ? 45.0f : 0.0f);
float jitterPitch = Math.abs(f8 / f9) * (attackTimerPassed ? 45.0f : 0.0f);
// Итоговая ротация с джиттером и дрейфом - 1:1 строка 68
float finalYaw = MathHelper.lerp(0.85f, currentRot.getYaw(),
currentRot.getYaw() + MathHelper.clamp(f7, -jitterYaw, jitterYaw) + f10);
float finalPitch = MathHelper.lerp(0.85f, currentRot.getPitch(),
currentRot.getPitch() + MathHelper.clamp(f8, -jitterPitch, jitterPitch) + f11);
handler.rotate(new Rotation(finalYaw, MathHelper.clamp(finalPitch, -90f, 90f)),
moveCorrection, 180f, 180f, 180f, RotationPriority.TO_TARGET);
}
/**
* 1:1 порт l.木大.口(int, int) - random между min и max включительно
*/
private int randomBetween(int min, int max) {
return min + (int)(Math.random() * (max - min + 1));
}
/**
* Вызывается при атаке - сброс состояния
*/
public void onAttack() {
smoothbackShakeStartMs = -1L;
pointFinder.resetOffset(null);
}
/**
* Получение суженного хитбокса для FunTime
* 1:1 порт из l.雨鶴 строки 484-492
*/
public Box getReducedHitbox(Box original) {
if (original == null) {
return null;
}
Vec3d center = original.getCenter();
double widthReduction = Math.max((original.maxX - original.minX) * 0.4, 0.01);
double depthReduction = Math.max((original.maxZ - original.minZ) * 0.4, 0.01);
return new Box(
center.x - widthReduction,
original.minY,
center.z - depthReduction,
center.x + widthReduction,
original.maxY,
center.z + depthReduction
);
}
public int getReducedHitboxAttackCounter() {
return reducedHitboxAttackCounter;
}
public void incrementReducedHitboxCounter(int amount) {
reducedHitboxAttackCounter += amount;
}
public void resetReducedHitboxCounter() {
reducedHitboxAttackCounter = 0;
}
}